secr-cli is a fast and minimal command-line tool written in Go for scanning Git repositories for sensitive information such as API keys, tokens, and private keys. It uses goroutine-based concurrent scanning and respects .gitignore rules out of the box.
- 40+ detection rules for API keys, tokens, credentials, and secrets
- Severity levels (HIGH / MEDIUM / LOW) for all rules
.gitignore-aware — automatically skips ignored files- Concurrent scanning — goroutine worker pool for fast file scanning
- Git integration — pre-commit hook management and git command passthrough
- JSON output — machine-readable output for CI/CD pipelines
- Staged-only mode — scan only what you're about to commit
Download the latest precompiled binary for your platform from the Releases page.
chmod +x secr-cli
sudo mv secr-cli /usr/local/bin/Requirements: Go 1.21+
git clone https://github.com/s4nj1th/secr-cli
cd secr-cli
sudo make installVerify:
secr-cli --help# Scan the repo (staged + unstaged + working directory)
secr-cli
# Show secret content (careful!)
secr-cli --show# Scan only staged changes (great for pre-commit)
secr-cli scan --staged-only
# Output as JSON (for CI/CD)
secr-cli scan --json
# Filter by severity
secr-cli scan --severity HIGH
# Scan everything, ignore .gitignore rules
secr-cli scan --no-gitignore
# Control concurrency
secr-cli scan --workers 8Install a Git pre-commit hook that automatically scans for secrets:
# Install the hook
secr-cli hook install
# Remove the hook
secr-cli hook uninstallAfter installation, every git commit will automatically scan staged changes first.
Run any Git command with an automatic secret scan:
secr-cli git commit -m "my changes"
secr-cli git push origin main
secr-cli git merge feature-branchIf secrets are detected, the Git command is aborted.
# List all detection rules with severity
secr-cli rules
# Show scan status summary
secr-cli status
# Print version
secr-cli versionYou can also alias git to always scan first:
alias git='secr-cli git'Add to your shell config (~/.bashrc, ~/.zshrc) to make it persistent.
See all patterns in RULES, or run secr-cli rules to list them in terminal.
Categories: Cloud Credentials, API Tokens, Cryptographic Material, Database Credentials, Authentication, Payment Information, Generic Patterns.
We welcome contributions! Please see CONTRIBUTING.
Open issues or submit pull requests to:
- Add more detection rules
- Improve CLI usability
- Support SARIF output
- Add custom rule configuration
This project is licensed under the GNU General Public License v3.0. See the COPYING file for details.