- Home
- The 30 checks
- A private key is committed
A private key is committed
In plain English: A private key is a long secret that proves your server is who it says it is, such as the key a Firebase service account or a sign-in provider gives you. It is saved in your project, so anyone with a copy of the code can act as your server.
What happens if you ship it
Anyone with a copy of the repo can act as your server: sign login tokens, use your Google or Firebase project as an admin, or call the service the key belongs to.
How to fix it technical
Let your AI tool fix it
Paste this into Lovable, Bolt, Cursor, Replit or Claude Code:
Fix this problem in my project: A private key is committed. Revoke this key with its provider and create a new one. Keep the new key in a server environment variable or a secret manager, and add the file to .gitignore. Deleting the file later does not remove it from git history. Change only what this fix needs, then tell me what you changed and anything I have to do myself.Check your app
Run npx sigship in your project folder. It reports this problem as private-key-in-code, along with 29 other checks. Nothing leaves your computer. New to the terminal?
Questions
What does a private key look like?
A block of text that starts with -----BEGIN PRIVATE KEY----- (or RSA, EC or OPENSSH PRIVATE KEY), often inside a JSON file such as serviceAccountKey.json. SIGSHIP points to the file and line without printing the key.
Is deleting the file enough?
No. Git keeps every old version, so the key stays in the history. Revoke the key in the provider's console, create a new one, and keep it in a server environment variable or a secret manager.
What about the public key?
A public key is meant to be shared and is fine to commit. Only the private half has to stay secret.