gitsearch is a small Python CLI utility that finds files matching a pattern in two places:
- Git history (all commits)
- Current filesystem
It is useful for checking whether sensitive files (like .env, key files, or password-related filenames) exist now or were committed in the past.
- Python 3.8+
- Git (This should be obvious)
No package installation is required.
- Clone the repository:
git clone https://github.com/kavin0x/gitsearch.git
cd gitsearch- (Optional) Make the script executable:
chmod +x gitsearch.pyRun with Python:
python3 gitsearch.py "*.env"Or, if executable:
./gitsearch.py "*.env"- Glob:
"*.env","*apikey*","*.pem" - Substring:
"secrets","password" - Regex (wrapped in
/.../):"/^\.env\..*$/"
Search both git history and filesystem:
python3 gitsearch.py "*apikey*"Search only git history:
python3 gitsearch.py "*.pem" --git-onlySearch only filesystem:
python3 gitsearch.py "*password*" --fs-onlySearch a specific path/repo:
python3 gitsearch.py "secrets" --path /tmp/project --repo /tmp/project0: One or more matches found1: No matches found
This makes it easy to use in CI checks or pre-release scans.