RepoSanitize APIยถ

RepoSanitize is a command-line tool and Python library for identifying and removing sensitive files and secrets from Git repositories. It is designed to help developers and teams sanitize their codebases before sharing, archiving, or open-sourcing.


๐Ÿš€ Featuresยถ

  • ๐Ÿ” Detects secrets using regex and file patterns

  • ๐Ÿง  Scans common config, credential, and token files

  • ๐Ÿ›ก๏ธ Automatically updates .gitignore

  • ๐Ÿงฌ Supports custom search paths

  • ๐Ÿ—ƒ๏ธ Creates backup branches before rewriting history

  • ๐Ÿงน Uses git filter-branch to scrub files from all commits

  • ๐ŸŽจ Beautiful CLI output with rich


๐Ÿงฐ Installationยถ

poetry add repo-sanitize
# or install globally
poetry install && poetry run python -m repo_sanitize.cli

๐Ÿ“ฆ Usageยถ

python -m repo_sanitize <path-to-repo> [--paths path1 path2 ...] [--private] [--verbose]

Examplesยถ

# Sanitize a full repo
python -m repo_sanitize ~/projects/myrepo

# Target specific subfolders
python -m repo_sanitize . --paths config/ secrets/

# Create a private backup branch before cleaning
python -m repo_sanitize . --private

๐Ÿ“„ Documentationยถ

Full API documentation is available at: ๐Ÿ‘‰ ReadTheDocs

Includes:

  • API Reference for RepoSanitizer

  • CLI options

  • Git integration helpers


๐Ÿงช Developmentยถ

poetry install
nox -s lint tests docs

Linting, Type Checks, and Docs Previewยถ

nox -s lint
nox -s typecheck
nox -s docs

๐Ÿ“˜ Licenseยถ

MIT License ยฉ 2025 William R. Astley / Pr1m8