Scan modes
gitleaks git
Scan commit history of the current repo
gitleaks git <repo-path>
Scan another repository
gitleaks dir <path>
Scan a folder or single file
cat <file> | gitleaks stdin
Scan piped data
gitleaks git --log-opts="<opts>"
Pass git log options to limit commits
Anything git log accepts works, for example --all or a range
such as commitA..commitB.
gitleaks git --log-opts="--all"
Include all branches and tags
-v / --verbose
Print each finding in detail
gitleaks version
Show the installed version
Baseline and ignores
gitleaks git -r baseline.json
Create a baseline from today's findings
-b <baseline.json>
Report only findings not in the baseline
// gitleaks:allow
Comment on a line to skip its findings
Add it as a comment in whatever the file's syntax is, on
the same line as the secret.
--ignore-gitleaks-allow
Ignore gitleaks:allow comments
.gitleaksignore
Repo file listing finding fingerprints to skip
Experimental. Put one fingerprint per line, copied from a
finding's Fingerprint field.
-i <path>
Path to .gitleaksignore or its folder
Configuration
-c <file>
Use this config file
.gitleaks.toml
Config picked up from the scan target
GITLEAKS_CONFIG=<file>
Config path via environment
GITLEAKS_CONFIG_TOML=<toml>
Config content via environment
--enable-rule <id>
Run only the given rule IDs
[extend] useDefault = true
Keep default rules and add your own
[extend] disabledRules = ["<id>"]
Turn off inherited rules
[extend] path = "<file>"
Extend a custom config file
Cannot be combined with useDefault. Chaining works to a depth
of 2.
[[rules]] id, regex, keywords
Define a custom detection rule
secretGroup / entropy
Pick the capture group; require randomness
path = '''<regex>'''
Restrict a rule to matching file paths
Allowlists
[[allowlists]]
Global allowlist block
Replaced the single [allowlist] table in v8.25.0.
paths = ['''<regex>''']
Skip files by path regex
regexes =
['''<regex>''']
Skip findings matching a regex
commits = ["<sha>"]
Skip findings in given commits
stopwords = ["<word>"]
Skip findings containing a word
regexTarget = "line"
Match regexes against secret, match or line
condition = "AND"
Require all criteria instead of any
targetRules = ["<id>"]
Scope a global allowlist to some rules
[[rules.allowlists]]
Allowlist for a single rule