Sub topic 17
Troubleshooting blocked pushes and merges
This chapter assumes you know how classic branch protection rules and rulesets work, including status checks, CODEOWNERS, bypass actors, and how several rule sources combine on one branch. It gives you a repeatable way to find which rule is blocking you.
Read the message first
The error text tells you which system blocked you.
GH006: Protected branch update failedcomes from a classic branch protection rule.GH013: Repository rule violations foundcomes from a ruleset. It lists each violated rule.- On a pull request, the merge box lists unmet requirements, such as a missing review or a failing check.
A triage routine
List every ruleset rule that applies to the branch, and then the classic rule:
gh api repos/OWNER/REPO/rules/branches/main
gh api repos/OWNER/REPO/branches/main/protectionThe first command returns rules from all active rulesets, including organization rulesets. The second returns the classic rule and fails with a 404 if none exists. Rules from both sources apply together, so the most restrictive combination wins.
Common causes
| Symptom | Likely cause | Fix |
|---|---|---|
| Check shows "Expected, waiting for status" forever | The required check name does not match any reported check. A workflow with path filters may also not have run. | Copy the exact name from a passing run. Make sure the workflow runs on every pull request. |
| "Branch is out of date" | Strict status checks are enabled. | Update the branch, then wait for the checks to run again. |
| Approved but still blocked | A new push dismissed the approval, or a code owner has not reviewed. | Get a fresh approval, including one from the owners in CODEOWNERS. |
| Direct push rejected | A pull request is required. | Push to a feature branch and open a pull request. |
| Force push rejected | Force pushes are disabled, which is the `non_fast_forward` rule in rulesets. | Use a revert commit, or `git push --force-with-lease` to a branch that allows it. |
| Push rejected for an unsigned commit | A signed commits rule is active. | Sign the commits and rewrite the unsigned ones. |
| Administrator is blocked | Administrators are included in the rule, or the ruleset has no bypass actors. | Add a bypass actor, or accept the restriction. |
Two traps
A rule that looks missing may come from a ruleset at the organization level, so check that level when the repository settings show nothing. Also check ref patterns. A pattern such as release/* does not match release/1.0/hotfix, but release/**/* does.
Exercise
A push to main fails with "GH013: Repository rule violations found", and the repository settings show no branch protection rules. Where should you look, and which command lists the rules that apply?
Show answer
GH013 means a ruleset blocked the push, so classic protection is not the cause. Check the repository's rulesets and also organization-level rulesets that target this repository. Run gh api repos/OWNER/REPO/rules/branches/main to list all active ruleset rules for the branch.