Skip to content

push errors

GH013 repository rule violations: what each rule line means and how to push again

Othman Shareef · November 22, 2026 · 6 min read


You pushed and got remote: error: GH013: Repository rule violations found for refs/heads/main. A ruleset on that branch rejected the push, and nothing landed. The lines under that header say which rule failed. Most of the time it is “Changes must be made through a pull request”, and the fix is to push to a new branch and open a pull request. Fixes for the other rules are below.

What does GH013 repository rule violations found mean?

A ruleset is a named list of rules for branches or tags, and GH013 means your push broke at least one of them. Rulesets run alongside classic branch protection rules. GitHub enforces every matching rule, and when two versions of the same rule apply, the stricter one wins, so a branch can look unprotected under Settings, Branches and still reject your push. Our rulesets vs branch protection post covers how they stack.

To see what applies, add /rules to the repository URL, or open the branch dropdown, click View all branches, and click the shield icon next to the branch. Anyone with read access can see them. Admins get more under Settings, Rules, Insights: a timeline of pushes that passed, failed, or bypassed a ruleset, with View rule runs showing the exact rule that failed.

How to fix “Changes must be made through a pull request”

The branch has the Require a pull request before merging rule, so direct pushes are refused. Move your commits to a branch and push that:

git switch -c fix-login-redirect
git push -u origin fix-login-redirect

Then open a pull request. If you want your local main to match the remote again, run git branch -f main origin/main from the new branch. The rule only requires that a pull request exists. Approvals are a separate setting in the same rule, and when they are on, the pull request waits for them. Our guide to required approving reviews covers that block.

Push rejected by required status checks

With required status checks, the checks have to pass with a successful, skipped, or neutral result before changes land on the branch. A commit you have only just made has no checks yet, so a direct push fails. Push to another branch, let CI run there, and merge through a pull request. If the check never reports, the pull request sits at Expected, waiting for status to be reported, which usually means a name mismatch. If you are waiting on green CI anyway, auto-merge merges the pull request once checks and reviews pass.

Push rejected for unsigned commits

Require signed commits lets only signed and verified commits onto the branch. Set up signing first (GPG, SSH, or S/MIME, with the key added to your GitHub account), then rewrite the unsigned commits and force push your branch. To re-sign every commit since main:

git rebase --exec 'git commit --amend --no-edit -S' main
git push --force-with-lease

This rule also applies to pull requests. GitHub checks the commits in a test merge, so unsigned commits on the head branch can block a squash merge even though GitHub signs the squash commit itself. Re-sign the branch, or ask someone with bypass permission to merge it.

Push rejected by Require linear history

Require linear history blocks merge commits on the branch, so pull requests have to merge with squash or rebase. If your push has a merge commit, usually from git pull without rebase, replace it with a rebase:

git fetch origin
git rebase origin/main

Allowing force pushes does not get around this. GitHub still refuses a force push that contains merge commits when linear history is required.

GH013 with push protection: push cannot contain secrets

Secret scanning push protection blocks pushes that contain supported secrets, such as a GitHub personal access token. The output lists each secret type with the commit and file path it was found in. Deleting the line in a new commit does not help, because the old commit still holds the secret.

  • Secret in the latest commit: remove it, run git commit --amend --all, and push.
  • Secret in an earlier commit: run git rebase -i <COMMIT-ID>~1 on the earliest commit that has it, change pick to edit, remove the secret, git commit --amend, then git rebase --continue and push.

If it is a test value or a false positive, open the URL from the error while signed in as the person who pushed, choose a reason (“It’s used in tests”, “It’s a false positive” or “I’ll fix it later”), click Allow me to push this secret, and push again within three hours.

Other rules behind a GH013 rejection

Block force pushes and Restrict deletions are on by default in a new ruleset, so rewriting or deleting a protected branch fails unless you have bypass permission. Restrict updates lets only bypass users push at all. Metadata rules, such as a commit message pattern, reject the push with the pattern it expected, so amend the message to match. File path and file size rules can have exceptions, which an admin adds.

Most of these fixes end with a pull request, and from there the blockers are approvals and checks. Pyor keeps the merge box in an inspector beside the conversation, so you see them while you review. Small pull requests get their approvals sooner, the case we make in how big a pull request should be.

Frequently asked questions

What does GH013 mean on git push?

GitHub rejected the push because it broke a rule in a ruleset that targets the branch or tag you pushed to. The lines under the GH013 header name the rule. Nothing from the push landed, so you can fix your local commits and push again.

How do I see which rulesets apply to a branch?

Anyone with read access can view them. Add /rules to the repository URL, or open the branch dropdown, click View all branches, and click the shield icon next to the branch. A pull request blocked by rules also links to them from its merge box.

Can an admin bypass a GH013 rule violation?

Only if the ruleset lists them. Bypass permission is set per ruleset and can go to roles, teams, or GitHub Apps. Admins can review every pass, failure, and bypass under Settings, Rules, Insights. If you are not on the bypass list, fix the commits instead.

Review your next PR in Pyor.

Pyor’s merge box updates the branch, merges with any method the repo allows, turns on auto-merge, or joins the merge queue, in the same window you review in. Free for individuals, and it talks to GitHub straight from your machine.