GitHub Push Blocked: Repository Rule Violations (GH013 / Secret Detected)

Share
Ongoing All platforms Updated November 13, 2026Based on 4 user reportsHow we research

Quick answer

GitHub push protection found something that looks like a secret in a commit you are pushing. Remove it from every commit being pushed (not just the latest file), revoke it if it was real, and push again.

Most likely fix: Read which commit and file contains the secret

How to fix it

Try these in order — the most common fix is first.

  1. 1. Read which commit and file contains the secret

    1. The error output lists the secret type, commit SHA and path
    2. If the secret was real, revoke or rotate it first
    Did this fix it?
  2. 2. Remove it from the latest commit

    1. Delete the secret from the file and move it to an environment variable
    2. git add the file and run git commit --amend
    3. git push
    Did this fix it?
  3. 3. Remove it from older unpushed commits

    1. Run git rebase -i origin/main~N or git reset --soft to the last clean commit
    2. Recommit without the secret and push
    3. For secrets deep in history use git filter-repo
    Did this fix it?
  4. 4. Bypass only for false positives or test values

    1. Open the URL printed in the push error
    2. Choose the reason (false positive, used in tests, will fix later) and push again
    3. Bypass requests can alert admins and may need approval on some organizations
    Did this fix it?

Symptoms

git push fails with 'GH013: Repository rule violations found' and 'Push cannot contain secrets', listing the file, line and commit.

Why it happens

  • A token, API key or credential is in one of the commits being pushed
  • The secret was committed earlier, so deleting it in a new commit still leaves it in history
  • A test value or false positive matches a secret pattern
  • An organization ruleset blocks the push for other reasons (the message lists the rule)

This guide also covers

  • gh013 repository rule violations found
  • github push protection blocked push secret
  • push cannot contain secrets github
  • github remove secret from commit history

Still not working?

If GitHub keeps failing, you're not alone. See every GitHub problem users report or the alternatives people switch to.

Need a custom web app or internal tool? Our small team builds it, on your domain or hosted by us. Price agreed together.

Get a quote
Fixed it? Share this guide

Other GitHub errors

All 11 GitHub errors and fixes →