RepoSanitize
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
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
Metadata
Release files for repo-sanitize 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| repo_sanitize-0.1.0.tar.gz | 5.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| repo_sanitize-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.0 kB
Release files / repo_sanitize-0.1.0.tar.gz
| Download URL | repo_sanitize-0.1.0.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
439188a4708dbe2a259e59a062c25506bf3327952e9f1e155701187ed8615e45
|
|
BLAKE2b-256 checksum How to use checksums |
5eecabd1dfc3439a8fdc0b8c1e9486135803e2670adf39f1b479ce0642109d21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.12.3 Linux/5.15.167.4-microsoft-standard-WSL2
|
Release files / repo_sanitize-0.1.0-py3-none-any.whl
| Download URL | repo_sanitize-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6afdd9c684c2bb7e2858c8980f7d6954e2a2aa208500fb2397e8b6d3465fdddb
|
|
BLAKE2b-256 checksum How to use checksums |
6567e238bf9cd6c9fc3a0e73870e4019d14b33bce49fdde58d450a5f08591ea1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.12.3 Linux/5.15.167.4-microsoft-standard-WSL2
|