Skip to content

kavin0x/gitsearch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

gitsearch

gitsearch is a small Python CLI utility that finds files matching a pattern in two places:

  1. Git history (all commits)
  2. 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.

Requirements

  • Python 3.8+
  • Git (This should be obvious)

Installation

No package installation is required.

  1. Clone the repository:
git clone https://github.com/kavin0x/gitsearch.git
cd gitsearch
  1. (Optional) Make the script executable:
chmod +x gitsearch.py

Usage

Run with Python:

python3 gitsearch.py "*.env"

Or, if executable:

./gitsearch.py "*.env"

Pattern Types

  • Glob: "*.env", "*apikey*", "*.pem"
  • Substring: "secrets", "password"
  • Regex (wrapped in /.../): "/^\.env\..*$/"

Common Examples

Search both git history and filesystem:

python3 gitsearch.py "*apikey*"

Search only git history:

python3 gitsearch.py "*.pem" --git-only

Search only filesystem:

python3 gitsearch.py "*password*" --fs-only

Search a specific path/repo:

python3 gitsearch.py "secrets" --path /tmp/project --repo /tmp/project

Exit Codes

  • 0: One or more matches found
  • 1: No matches found

This makes it easy to use in CI checks or pre-release scans.

About

Just a simple tool to find if a certain file, or content was checked in to a git repo.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages