Who it is forA team lead inheriting an old repo who needs to know whether credentials ever leaked into it.
The problemA secret deleted in a later commit is still in git history, where anyone with the repo can find it.
The outcomeA report of every secret found, with the file, line, commit and author, so you can rotate them.
What you need first
- Homebrew, Docker, Go to build from source, or a release binary
- pre-commit if you want the hook
- Read access to the repos or folders you scan
Steps
- Install with
brew install gitleaksordocker pull zricethezav/gitleaks:latest - Run
gitleaks git -vinside the repo to scan its git history with verbose output - Save a report with
gitleaks git --report-path gitleaks-report.json - Use --redact so secrets are hidden from logs and stdout when you share output
- Rotate every real credential it finds; removing it from the code alone is not enough
Prompt for your agent
Install gitleaks/gitleaks and scan the full git history of <repo> with redaction on, saving a JSON report. Summarize the findings by rule and file, mark likely false positives, and list which credentials I should rotate first.
Caveat. Gitleaks is feature complete and now gets security patches only; the maintainer points to Betterleaks for new development.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for gitleaks/gitleaks and "Scan a repo's full history for leaked secrets"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer