How to Set Up Secret Scanning with GitGuardian in 30 Minutes
GitGuardian is a secret detection service: it scans commits, PRs and full git history for API keys, tokens, private keys and database credentials, then alerts you with the file, commit and author. The GitHub App install takes about five minutes; 30 minutes gets you history scanning and a pre-commit hook too.
The important number: GitGuardian’s public honeypot study found leaked secrets get exploited within hours, not weeks. A leak is not a warning sign, it is an incident.
How do you install GitGuardian on GitHub?
- Sign up at
dashboard.gitguardian.comwith GitHub. - Click Integrate → GitHub, then install the GitHub App.
- Grant access to all repos, or specific ones. All repos is the honest choice — leaks are usually in the repo nobody thought about.
- Wait for the initial history scan. A 500-repo org takes 20-60 minutes.
- Add your team under Settings → Members and set up the Slack or Teams webhook.
Paying for GitGuardian above 25 developers is roughly $18-30 per developer per month, so the free tier decision has a real ceiling: it covers up to 25 seats and unlimited public repos.
What does the history scan find?
Typically 3-15 secrets on a first scan for a company that has never run one. The most common are .env files committed early, then deleted in a later commit — which does nothing, because the key lives in the history forever.
And a real category people forget: secrets in CI config, test fixtures with a staging database password, and Postman collections.
GitGuardian categorises by validity — checking the public APIs of AWS, GitHub, Stripe and about 20 others to see whether a key is live. A live key is an urgent incident. A revoked one is housekeeping.
What is the correct response to a live leak?
Revoke first, investigate second. This order is not negotiable.
- Rotate or revoke the credential at the provider. Not after the investigation. Now.
- Check the provider’s audit log for usage between the leak commit and the revocation.
- Mark the incident in GitGuardian as Revoked with the revocation date.
- Rewrite history only if the repo is private and the secret cannot be rotated. Rewriting is a coordination problem and breaks every clone.
For a public repo, assume it is compromised. Bots scan GitHub commits continuously; a Stripe key pushed to a public repo often shows unauthorised charges within 24 hours.
How do you stop leaks before they happen?
GitGuardian’s ggshield CLI as a pre-commit hook. Install pip install ggshield, then ggshield secret scan pre-commit in the hook.
It scans staged changes in about 200-500 ms and blocks the commit on a detection. Across a team of 20 with 15 commits a day each, that is maybe 30 seconds of added wall time per person per day. Cheap.
The hook fails open when the API is unreachable, which is a reasonable trade-off but means it is not a hard guarantee. Server-side detection in PRs remains your real net.
Where GitGuardian gets noisy
False positives. Test fixtures with fake keys, documentation examples, and base64 blobs that look like credentials. The dashboard lets you ignore a specific secret instance or a whole pattern — do per-instance ignores for tests, never per-pattern, or you blind yourself to real leaks in the same format.
Second annoyance: a secret pushed in a PR generates an alert per commit, so an amended branch fires three or four times. Filter alerts by PR in the dashboard rather than triaging each commit.
Honest positioning
GitGuardian is the best-in-class tool for GitHub and GitLab secret detection, and for a 5-person team the free tier is generous enough that there is no reason to rely on GitHub’s built-in push protection alone — though that is free and you should enable it too, in Settings → Code security → Secret scanning → Push protection.
Skip it if you are on Azure DevOps or Bitbucket Cloud; support exists but is thinner, and the detection depth on non-GitHub platforms is noticeably lower.
Key Takeaways
- Install the GitHub App on all repos; the initial history scan takes 20-60 minutes for 500 repos.
- First scan of an unscanned org typically finds 3-15 secrets, most in deleted
.envfiles. - Revoke the credential before investigating — public repo leaks get used within 24 hours.
- Add
ggshield secret scan pre-commit; it adds ~200-500 ms per commit. - Free for up to 25 seats and unlimited public repos; paid is roughly $18-30/developer/month.
