GitHub Push Protection Blocking Your Push (GH013)

Updated 2026-12-03

The push fails with something like remote: error: GH013: Repository rule violations found for refs/heads/<branch>. followed by remote: - GITHUB PUSH PROTECTION and remote: Push cannot contain secrets. That's GitHub secret scanning's push protection: the commit you're pushing contains a line that matches the shape of a known secret, so GitHub refuses the push outright, before it ever reaches the repository.

Why it fires on things that aren't real secrets

Push protection is pattern-matching, not a live-credential check. It flags: recognized provider token formats (AWS, Stripe, GitHub tokens and more, via GitHub's secret scanning partner program), private key blocks (-----BEGIN ... PRIVATE KEY-----), and, on repos where it's enabled, generic-looking password = "..." or api_key: "..." assignments detected by a model rather than a fixed pattern. A unit test fixture with a fake-looking AWS key, an old token pasted into a changelog for documentation, or a sample .env.example committed by mistake can all trip the same block as a genuine leak — the scanner has no way to know the value is dead or fake just by looking at its shape.

How to clear it

  1. Read the rejection output fully — it includes a link to a GitHub page for that specific secret/commit, plus which file and line matched.
  2. If it's a real secret: don't just push past it. Rotate/revoke the credential first, then remove it from the commit (git rebase -i <commit>~1, edit the commit to drop the line, git commit --amend, git rebase --continue, then force-push the rewritten branch).
  3. If it's a false positive and you have bypass permission on the repo: open the URL from the error, pick "it's used in tests" or "it's a false positive," and allow that one secret through — this doesn't disable scanning, it allows just that match.
  4. If you don't have bypass permission: a repo admin or org owner has to grant it, or approve a bypass request you submit from that same URL — there's no way around this from the command line alone.
  5. Either way, the commit has to actually change (removed secret) or be explicitly allowed before GitHub's push protection will accept it; retrying the identical push again does nothing.

GitHub push protection vs. Rithub, honestly

GitHub (push protection on)Rithub
When a matched secret is caughtAt push time — the push is rejectedNot at push time — pushes are never scanned or blocked
Where it's visibleCommand-line rejection + a bypass-decision pageA non-blocking "possible secret in diff" flag on the pull request's review panel, after the push
False positives on fixtures/placeholdersCan still block the push; needs a bypassFlagged for a human to look at, never blocks anything
Real protection against a genuine leak reaching the repoYes, at the point of pushNo — use a real pre-commit/CI scanner (gitleaks, trufflehog) if you need that guarantee

This isn't a "Rithub is better" page — fewer surprise blocks also means less of a safety net. If push-time secret rejection is the actual thing you rely on, keep it; if it's mostly been a source of false-positive friction on test fixtures and placeholders, that friction specifically doesn't exist on Rithub.

Sign up freeImport from GitHub