A push is rejected: "GH013: Repository rule violations found ... Push cannot contain secrets". What do you do?
IntermediateScenarioSecrets, Signing and Security
Answer
Situation read → GitHub push protection detected a known secret pattern in your commits.
What I'd do →
- Read the message; it names the file and commit.
- Remove the secret from the commit, not just the latest file state: amend or interactive rebase, so no commit in the push contains it.
- Load the value from an environment variable or secret manager instead.
- If it is a verified false positive or test token, use the bypass link and choose a reason; that is logged.
Why → Blocking before the push means the secret never reaches the remote, which beats cleaning afterwards.
Interview tip → Treat a real hit as a leak anyway if the secret was ever valid: rotate it.
More on Secrets, Signing and Security
A developer pushed an AWS access key to a public repo 10 minutes ago. What is your first move?BeginnerAfter rotating the leaked key, you must purge it from repository history. How?AdvancedSecret scanning alerts have piled up, and many look like false positives or old test credentials.IntermediateYou must set up signed commits on your laptop. Which method do you pick?BeginnerYour GPG signing key expires next week. What is the correct way to handle it?IntermediateA release bot pushes commits, and branch rules require signed commits. How do you handle it?Intermediate