Gitleaks detects passwords, API keys, tokens and other secrets in the
history of Git repositories, in directories and files, and in text read
from standard input. It prints findings or writes them as JSON, CSV,
JUnit, SARIF or a custom template, and its rules can be extended with a
TOML file.
Examples
gitleaks git -v ~/projects/my-project
gitleaks dir -v ~/projects/my-project
cat notes.txt | gitleaks stdin
gitleaks git --pre-commit --staged --redact -v
File access
Gitleaks can scan repositories and files in your home directory. To
also scan USB drives and other removable media (/media, /mnt), run:
sudo snap connect gitleaks:removable-media
The snap includes Git and has no network access.