VibeDict

🌿Push blocked because it contains a secret key

What you'll see
remote: error: GH013: Repository rule violations found … Push cannot contain secrets

The code you're uploading contains a secret value like an API key, so GitHub blocked it for you. This is a helpful error.

🤔 Why does it happen?

  • An API key was written directly in the code or a .env file and committed

🔧 Try this

  1. Treat that key as already exposed: revoke it in the service and get a new one
  2. Keep keys only in .env.local and add it to .gitignore
  3. Ask the AI how to remove the key from the commit history

🤖 Ask your AI like this

My git push was blocked with 'Push cannot contain secrets'. Please tell me the steps to remove the secret key from the code and the commit history, move it to an environment variable, and set up .gitignore. Don't ask me for the key's value.

Replace the [ ] parts with your own situation, and paste the error with a few extra lines before and after it.

Related terms

Other errors in this group