sanitize-git-repo

Detect and remove sensitive credentials from Git repositories and their commit history using pattern, file-based and entropy methods.

Updated Feb 24, 2026
One-click install
npx skills add https://github.com/Zurybr/lefarma-skills --skill sanitize-git-repo-zurybr
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sanitize-git-repo
Source: https://github.com/Zurybr/lefarma-skills/tree/main/letta/benchmarks/trajectory-only/sanitize-git-repo
Command: npx skills add https://github.com/Zurybr/lefarma-skills --skill sanitize-git-repo-zurybr

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a systematic approach to identify and remove sensitive information like API keys, credentials, and tokens from both the current working directory and the entire Git history of a repository, preventing accidental exposure.

Core Features & Use Cases

  • Comprehensive Secret Detection: Utilizes pattern-based, file-based, and entropy-based methods to find secrets.
  • Working Directory Sanitization: Replaces secrets in current files with placeholders.
  • Git History Sanitization: Employs tools like BFG Repo-Cleaner or git-filter-repo to remove secrets from past commits.
  • Use Case: Before releasing a private project publicly, use this skill to ensure no API keys or sensitive configuration details are present in the code or its history.

Quick Start

Execute the sanitize-git-repo skill to clean all secrets from the current repository's working directory and git history.

Frequently Asked Questions about sanitize-git-repo

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I remove API keys and credentials from Git history?

To remove API keys and credentials from Git history, the repository is sanitized using history rewriting tools like BFG Repo-Cleaner or git-filter-repo to strip sensitive tokens from past commits. Working directory secrets are also replaced with placeholders.

What is the best way to sanitize a Git repository before making it public?

Sanitizing a Git repository before public release involves detecting sensitive data using pattern-based, file-based, and entropy-based methods, then removing exposed secrets from both the current working directory and the entire commit history.

How does entropy-based secret detection work in version control?

Entropy-based secret detection in version control identifies high-randomness strings that likely represent credentials or API keys. This method complements pattern-based and file-based detection to comprehensively locate sensitive information in a repository.

Can I use BFG Repo-Cleaner to rewrite Git history and delete exposed tokens?

Yes, BFG Repo-Cleaner is explicitly utilized to rewrite Git history and delete exposed tokens. The sanitization process employs BFG Repo-Cleaner or git-filter-repo to effectively remove sensitive credentials from past commits.

Does Git history rewriting completely remove sensitive configuration details from past commits?

Git history rewriting using tools like git-filter-repo or BFG Repo-Cleaner removes sensitive configuration details from past commits. This sanitization process addresses security risks by ensuring accidental secret exposure in version control is systematically eliminated.