Scanning Git Repositories for Secrets with Gitleaks
Accidental exposure of passwords API keys and tokens in source code is a common source of data breaches. When secrets are committed to a Git repository they can be harvested by attackers and used to compromise services....
Accidental exposure of passwords API keys and tokens in source code is a common source of data breaches. When secrets are committed to a Git repository they can be harvested by attackers and used to compromise services. Detecting those secrets early prevents loss of reputation and costly remediation.
What it is Gitleaks is a secret scanning tool that works on Git repositories files and data provided via standard input. It is maintained by an independent open source project on GitHub. The project is licensed under the MIT licence. As of 24 Oct 2026 the repository has 30,279 stars on GitHub. The last commit was posted on 23 Oct 2026 and the most recent release is version v8.30.1 dated 21 Mar 2026.
What it finds Gitleaks looks for patterns that match passwords API keys tokens and other credentials. It uses regular expressions and entropy checks to flag potential secrets. Each finding includes the secret value a rule identifier the calculated entropy the file path line number the commit hash author email and date. The output also provides a fingerprint that uniquely identifies the finding.
How a small business would use it A web agency that builds client sites can integrate Gitleaks into the repository workflow to stop developers from pushing secrets to the remote. Before a code review the agency runs Gitleaks on the repository and fixes any flagged items. A small clinic that hosts a patient portal can scan the portal code on a weekly schedule to ensure no healthcare API keys have leaked. A startup with a micro‑service architecture can add Gitleaks as a pre‑commit hook and as a GitHub action so every pull request is scanned automatically.
Trying it
Install with Homebrew
``
brew install gitleaks
`
Run with Docker from Docker Hub
`
docker pull zricethezav/gitleaks:latest
docker run -v ${path_to_host_folder_to_scan}:/path zricethezav/gitleaks:latest [COMMAND] [OPTIONS] [SOURCE_PATH]
`
Run with Docker from GitHub Container Registry
`
docker pull ghcr.io/gitleaks/gitleaks:latest
docker run -v ${path_to_host_folder_to_scan}:/path ghcr.io/gitleaks/gitleaks:latest [COMMAND] [OPTIONS] [SOURCE_PATH]
`
Build from source
`
git clone https://github.com/gitleaks/gitleaks.git
cd gitleaks
make build
``
For full configuration options and integration steps follow the README on the GitHub project page.
Limits Gitleaks relies on pattern matching and entropy calculations so it may miss secrets that do not match known patterns. It can also report false positives when non secret strings resemble secret formats. The tool does not remediate the leaks it only reports them; a human must review each finding and remove or rotate the secret. Gitleaks does not encrypt data or provide secret management capabilities.
The skull take Gitleaks gives small teams an inexpensive way to catch obvious credential leaks before they reach production. It should be used together with manual review and a broader security program.
Repository: https://github.com/gitleaks/gitleaks · facts checked on GitHub 24 Oct 2026.
First published on the skull blog: https://www.adris.tech/skull/blog/scanning-git-repositories-for-secrets-with-gitleaks
Built on your own machine, not someone else’s cloud.
adris is eight AI products in one desktop app. Free to install, and your data never leaves your computer.