Gitleaks: find keys and passwords committed to your code by mistake, free and open source
Gitleaks is a free command-line scanner that looks for secrets such as API keys, passwords and tokens in git history, folders or piped text. Based on the official README, not tested by us: what it does, its limits (the author says it is feature complete) and what we could not confirm.
Type
Secret scanner (command line)
License and cost
MIT licence, free
Reviewed
2 Nov 2026
Version
v8.30.1 (release page shows 21 March, no year)
Best for
Teams that keep code in git and want a free check that no key or password slipped into a commit.
Watch out for
The author calls it feature complete (security patches only). A finding means the key is exposed: revoke it.
← All tool profilesNo. 3 / 11
In one sentence
Gitleaks is a scanner that reads a git repository, a folder or text you pipe into it, and reports secretsSecret (API key, token, password) Any piece of text that proves to a service that you are allowed in, such as an API key, a database password or an access token. Tap again to open the glossary: passwords, API keys and tokens that should never sit in your code. It matches patterns, so it can find a key someone pasted into a file years ago and still lives in your git history.
Who it is for
Founders, indie makers and small teams who keep code in git, ship fast, often with help from AI assistants, and want a cheap check that no key slipped into a commit. It is a command-line tool, so you need to be comfortable typing commands.
What the documentation says
Everything below comes from the project's README, which we read on 2 November 2026.
- What it scans: the
gitcommand scans the history of a repository,dirscans folders or files, andstdinscans piped input. - Install: Homebrew on macOS, a Docker image (on Docker Hub and on the GitHub container registry), building from source with Go, or a prebuilt binary from the releases page.
- Before you commit: it works with the pre-commit framework, so a commit can be stopped when a secret is found. The README says you can skip it with an environment variable, which also means anyone can skip it.
- In your pipeline: there is a GitHub Action, kept as a separate project called gitleaks-action.
- Baseline: you can save a report and pass it back as a baseline, so later scans report only new findings. Useful when an old repository already has known leaks.
- Configuration: rules live in a
.gitleaks.tomlfile. You can add your own rules (an id and a regular expression, with optional keywords, entropy and path), extend the default rules and switch off specific ones. - Allowing a finding: a global or per-rule allowlist, a
gitleaks:allowcomment on the line, or a.gitleaksignorefile with fingerprints. The README marks the last one as experimental. - Reports: JSON, CSV, JUnit and SARIF, or a custom Go template.
- Exit codes: 0 means no leaks, 1 means leaks or an error (you can change this with a flag), 126 means an unknown flag. A script that ignores the exit code will miss findings.
The good
- Free, MIT licence, and a single tool for history, folders and piped text.
- It can run before a commit, so a secret may never reach the shared repository.
- A baseline lets you adopt it on an old project without drowning in past findings.
- Rules are plain configuration you can read and change.
The limits it admits
- The author calls the project "feature complete". The README says future releases will be limited to security patchesPatch (security update) A fix released by the maker of a piece of software to close a flaw or a bug. Tap again to open the glossary, and that the author is shifting focus to another project called Betterleaks. We did not read anything about that project beyond this mention.
- The
.gitleaksignorefeature is marked experimental in the README. - Older commands called
detectandprotectwere deprecated in v8.19.0 and are hidden but still available, so older guides online may show commands that have changed.
When not to use it
- If you think it replaces rotating a leaked key. Finding a secret in your history does not undo the leak. Treat the key as exposed.
- As your only line of defence. A pattern scanner can miss a secret that does not look like its patterns, and can flag things that are not secrets.
- If you want a hosted dashboard with alerts and teamwork features: this is a command-line tool, and we read nothing in the README about a hosted version.
What it costs you
Time more than money. The README gives no estimate of setup time. The real work comes after: tuning the rules and allowlists so the noise is small, adding it to the pre-commit step and to your pipeline, and deciding what to do with every real finding, which means revoking and replacing the key. We have not measured any of this.
Typical setup mistakes
- Scanning only the latest files. A secret deleted from the code still lives in the git history. The
gitcommand is the one that reads the history. - Ignoring the exit code. A pipeline that does not stop on exit code 1 can pass with leaks in it.
- Allowlisting too broadly. A wide allowlist or a
gitleaks:allowcomment on a real secret hides it from every later scan. - Treating a clean scan as proof. It means no pattern matched, not that no secret exists.
- Leaving the key valid after you found it. Revoke it and create a new one.
How to check that it works
Official documentation and our approach, not something we ran: in a throwaway test repository with a fake value that looks like a key, run the scan and expect a finding and exit code 1. Then remove the fake value and run it again to see exit code 0. Never use a real key for this test.
Where to start
We did not test the tool, so we do not offer a tutorial. Follow the official README: httpsHTTPS The secure version of the web address protocol: it encrypts what travels between a visitor and your site and checks that the site is the real one. Tap again to open the glossary://github.com/gitleaks/gitleaks
What we could not confirm
We did not download, install or run Gitleaks, so everything above is the README's own description. We did not read the project's documentation beyond the README, its rules in detail, or the code. The releases page showed version v8.30.1 with the date 21 March and no year, so we cannot state the release year; it also showed 26 commits on the main branch after that release. We do not know how well it detects secrets in practice, how many false alarms it gives, or how fast it is on a large history. We read nothing about the project mentioned as the author's new focus. We have not compared Gitleaks with other secret scanners.
Related
Glossary: secret. If a key has leaked, see our runbook 02, API key incident.
More free tools
Other profiles in this section.
- CrowdSec: a free, open source engine that reads your logs, spots attackers and blocks them, with a shared community blocklist: Intrusion detection and blocking engine (reads logs, blocks abusive IPs)
- Lynis: a free audit that checks a Linux server's security settings and tells you what to fix: Security audit and hardening tool (runs on the host)
- Semgrep: scan your own code for bugs and security mistakes before you ship, free and open source: Static code analysis scanner (command line)
- Bitwarden: an open-source password manager your team can self-host, free and paid options: Password manager (hosted service and self-hostable server)
- OpenVAS: a free scanner that checks your servers and apps for known weaknesses: Vulnerability scanner (part of the Greenbone Community Edition)
- OSV-Scanner: check the libraries your project uses for known vulnerabilities, free and open source: Dependency vulnerability scanner (command line)
- Trivy: scan your containers, code folders and dependencies for known vulnerabilities, free and open source: Vulnerability and misconfiguration scanner (command line)
- Wazuh: an open-source platform that watches your servers for suspicious activity: Security monitoring platform (agents, server, indexer and dashboard)
- Restic: encrypted backups you can restore, free and open source: Backup program (command line)
- SkillSpector: check an AI agent skill before you install it: Security scanner for AI agent skills (command line)
Sources
Follow us
New profiles and security news: YouTube (@safet2ship) and Instagram (@safet2ship).