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-branchto 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
RepoSanitizerCLI 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