Basic package to clean up github repos, removing secrets or env variables that arent supposed to be there.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file repo_sanitize-0.1.0.tar.gz.
File metadata
- Download URL: repo_sanitize-0.1.0.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.12.3 Linux/5.15.167.4-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
439188a4708dbe2a259e59a062c25506bf3327952e9f1e155701187ed8615e45
|
|
| MD5 |
cda50711067a4fd1c92ef1bd6b7379f6
|
|
| BLAKE2b-256 |
5eecabd1dfc3439a8fdc0b8c1e9486135803e2670adf39f1b479ce0642109d21
|
File details
Details for the file repo_sanitize-0.1.0-py3-none-any.whl.
File metadata
- Download URL: repo_sanitize-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.12.3 Linux/5.15.167.4-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6afdd9c684c2bb7e2858c8980f7d6954e2a2aa208500fb2397e8b6d3465fdddb
|
|
| MD5 |
3d32af8a825e840003060bd99efe34f7
|
|
| BLAKE2b-256 |
6567e238bf9cd6c9fc3a0e73870e4019d14b33bce49fdde58d450a5f08591ea1
|