Skip to main content
ASM Cheatsheet

Gitleaks

Beginner
Actively maintained

Detect hardcoded secrets in git history and block new ones in CI

https://github.com/gitleaks/gitleaks

Installation

brew install gitleaks

# Or via Docker
docker run --rm -v "$(pwd):/path" zricethezav/gitleaks:latest detect --source="/path"

Usage

Basic Usage

# Scan a repository's history
gitleaks detect --source . --verbose

# Scan only uncommitted changes (pre-commit use)
gitleaks protect --staged --verbose

# Machine-readable report for CI
gitleaks detect --source . --report-format json --report-path leaks.json

# Apply organization-specific rules
gitleaks detect --source . --config .gitleaks.toml