How do I stop exposed API keys in Git history, and which tool should I use?
We asked ChatGPT, Perplexity and Gemini this question on November 18, 2026. Here is who they named.
All three named GitHub.
| Brand | ChatGPT | Perplexity | Gemini |
|---|---|---|---|
| Named by all three | |||
| GitHub | Named, position 4 | Named, position 1 | Named, position 4 |
| Named by two | |||
| git-filter-repo | Named, position 1 | Not named | Named, position 6 |
| BFG Repo-Cleaner | Not named | Named, position 3 | Named, position 5 |
| git-secrets | Named, position 5 | Not named | Named, position 7 |
| Named by one | |||
| AWS | Not named | Not named | Named, position 1 |
| BFG | Named, position 2 | Not named | Not named |
| git filter-repo | Not named | Named, position 2 | Not named |
| Stripe | Not named | Not named | Named, position 2 |
| Gitleaks | Named, position 3 | Not named | Not named |
| OpenAI | Not named | Not named | Named, position 3 |
| truffleHog | Not named | Not named | Named, position 8 |
| HashiCorp Vault | Not named | Not named | Named, position 9 |
named, with its place in that answernot named
your companyIs it missing from this answer?
Run the free scanWhat each engine answered
ChatGPT
GPT-5.6, answering from model knowledge
- git-filter-repo
- BFG
- Gitleaks
- GitHub
- git-secrets
If an API key has ever been committed, assume it is compromised—even if the commit was deleted. 1. Revoke or rotate the key first Immediately disable the exposed key with the provider and create a replacement. History rewriting does not make the old key safe. 2. Remove it from Git history For most repositories, use git-filter-repo.
Perplexity
Sonar with live web search
- GitHub
- git filter-repo
- BFG Repo-Cleaner
If an API key is already in Git history, the first step is to revoke or rotate the key immediately in the provider’s dashboard, then replace it everywhere your app uses it; GitHub and other guides say this is the most important remediation step.
Gemini
Gemini 3.1, answering from model knowledge
- AWS
- Stripe
- OpenAI
- GitHub
- BFG Repo-Cleaner
- git-filter-repo
- git-secrets
- truffleHog
- HashiCorp Vault
Removing an exposed API key from Git history is a two-step process: revocation (making the old key useless) and purging (deleting the key from the commit history). Here is the step-by-step guide on how to handle this. Phase 1: Immediate Damage Control (Do NOT skip this) A Git commit history purge is not enough. If an API key was pushed to a public repository (like GitHub), bots likely grabbed it within seconds.
Sources Perplexity cited
Perplexity searched the web for this answer. The count is how many times the answer cited that site.
- docs.github.comcited 2 times
- squarecloud.appcited once
- dev.tocited once
- depo-platform-documentation.scrollhelp.sitecited once
- datahogo.comcited once
- github.comcited once
- checkmarx.comcited once