Skip to main content

A utility for recursively searching for files in .git directories using regex.

Project description

README

PyPI version Downloads

git-rg is a command-line tool for recursively searching for files in Git repositories that contain specific text patterns using regular expressions. It's useful for finding sensitive information like accidentally committed passwords or API keys within .git directories.

Installation

pipx install git-rg

To install latest version from Github:

pipx install git+https://github.com/s3rgeym/git-rg

Usage

git-rg <pattern> [path] [-B <num>] [-A <num>]

Arguments

  • pattern: Regular expression to search for.
  • path: Path to the directory where the search should begin (default: current directory).
  • -B, --before: Number of lines to show before the match.
  • -A, --after: Number of lines to show after the match.

Example

To search for passwords in all .git files within the current directory and show 2 lines before and after the match:

git-rg "(?i)password\s*=\s*['\"]?(\w+)['\"]?" ~/projects -B 2 -A 2

image

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git_rg-0.1.1.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

git_rg-0.1.1-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file git_rg-0.1.1.tar.gz.

File metadata

  • Download URL: git_rg-0.1.1.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.1.dev0+g94f810c.d20240510 CPython/3.12.6

File hashes

Hashes for git_rg-0.1.1.tar.gz
Algorithm Hash digest
SHA256 aab5c20ca76249a14ae586a3d8c41a04989691ce565400ed11e07d1838c79991
MD5 10f2ef63b660c3c142bffd40f5194612
BLAKE2b-256 86f854b41fb9fec022b18f15a0fd27d5c384a0d19bffdbd321737cae31d96ed5

See more details on using hashes here.

File details

Details for the file git_rg-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: git_rg-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.1.dev0+g94f810c.d20240510 CPython/3.12.6

File hashes

Hashes for git_rg-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 beba8d890aa79328f1ffbbfcc8b6fdd43f97595e6a41cff0f53edb2dd144d880
MD5 bd3e093e966dfeadda99b8153761e753
BLAKE2b-256 08110d480a618c1f0122887d3da7a17a09f7b2d0c12ea0a76991c237b947e468

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page