Gitleaks — an open-source secret scanner that finds hard-coded credentials in git repositories, in plain directories and in anything you pipe into it — is one of the most widely used tools for stopping API keys, tokens, passwords and private keys from ever reaching a remote. Written in Go under the MIT licence, it began in 2018 as a pre-commit hook and grew into a full static-analysis (SAST) scanner with 222 built-in rules covering the services that leak most often: AWS, GitHub, GitLab, Stripe, Slack, database connection strings, private-key blocks and many more. It is now maintained by Truffle Security, and the current release is v8.30.1 (March 2026). Because it scans the commit history rather than just the working tree, a credential that was committed in 2019 and quietly deleted in 2020 is still reported today — which is exactly the case a file-system scanner misses.
git walks a repository’s patch stream (--log-opts restricts it to a commit range), dir scans directories and individual files, and stdin scans piped data such as a database dump or a decompressed configuration archive.secretGroup), so a string that merely looks like a key can be rejected for being too predictable.[extend] useDefault = true and disable just the rules you do not want.regexTarget that can point at the secret, the match or the whole line. For one-off exceptions there is an inline gitleaks:allow comment, and for long-lived ones a .gitleaksignore file keyed on each finding’s fingerprint.--baseline-path, and only new findings are reported. Adopting a scanner on a ten-year-old repository does not have to mean a thousand alerts on day one.--max-decode-depth follows base64, hex and percent-encoded text recursively, and --max-archive-depth extracts zip and tarball contents (including archives nested inside archives) so a key hidden inside a build artefact is still found.--redact masks all or a chosen percentage of each secret so a report or log can be shared safely.--exit-code) so a leaking commit can fail a build instead of a review.Leaked secrets are the static-analysis failure that costs the most and is easiest to miss: the code is syntactically valid, the tests pass, and the key is simply in a string. Deleting it in the next commit does nothing, because git history keeps every version of every file — which is why the scanner has to look at commits, not just at the current tree. Gitleaks does that in a single self-contained binary with no runtime dependencies, finishes a full repository history in seconds, and runs entirely on your own machine: nothing is uploaded to a third-party service, so it is usable on private and regulated code. The rules are readable TOML rather than a black box, so you can see exactly why a finding fired, tune it, and version-control the change. The MIT licence removes the procurement conversation, and the project’s own README notes that gitleaks is now feature complete, with future releases limited to security patches as the original author’s attention moves to a successor project (Betterleaks) — it is stable, massively deployed software rather than a fast-moving one. If you do adopt it across a large organisation, note that the GitHub Action asks for a free licence key when scanning repositories owned by a GitHub organisation account; the CLI itself has no such requirement.
.env files, Kubernetes manifests, Terraform and Docker Compose are all just directories to gitleaks dir.Linux (x86-64, arm64, armv6/armv7, 32-bit x86) · macOS (Intel and Apple silicon) · Windows (x86-64, 32-bit, arm64) · Docker (Docker Hub and ghcr.io) · Homebrew · Go toolchain (go install) · packaged in Debian and other distributions (Debian ships 8.16.0)
MIT — the gitleaks CLI, its source and its default rule set. The separate GitHub Action is also open source but requires a free licence key when scanning organisation-owned repositories.
gitleaks.io · source on GitHub · gitleaks-action · Docker Hub · also see the Security & Privacy category for more tools that keep secrets and systems in check.