github-sensitive-data-cleanup

Scan and remove secrets, private domains, and PII from GitHub repository history.

1.4k|216|Updated Oct 22, 2025
One-click install
npx skills add https://github.com/daymade/claude-code-skills --skill github-sensitive-data-cleanup
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: github-sensitive-data-cleanup
Source: https://github.com/daymade/claude-code-skills/tree/main/github-sensitive-data-cleanup
Command: npx skills add https://github.com/daymade/claude-code-skills --skill github-sensitive-data-cleanup

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires gitpython, and includes scripts (resource) and references (resource) components.

What problem does it solve?

Accidentally committed secrets, internal domains, IPs, or PII remain in Git history even after deletion, and force-pushing a rewritten history to a public repo without verification can make leaks worse. This Skill provides a conservative, safety-gated workflow to scan, back up, rewrite, verify, and push a cleaned repository.

Core Features & Use Cases

  • Multi-layer scanning: Combines gitleaks, custom regex patterns, private gitleaks config rules, and a mandatory AI semantic review to find secrets and private context across all commits.
  • Safe history rewriting: Creates a verified git bundle backup before running git-filter-repo, covering both file content and commit messages.
  • Guarded push: Verifies repository visibility and fork count with gh before force-pushing with --force-with-lease, and never uses --no-verify.
  • Use Case: You pushed an internal domain and an API key to a public repo with forks. Rotate the key, then use this Skill to scan the history, rewrite both blobs and commit messages, verify nothing remains, and push safely.

Quick Start

Use the github-sensitive-data-cleanup skill to scan my repository for leaked secrets and guide me through safely rewriting its history.

Frequently Asked Questions about github-sensitive-data-cleanup

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

FAQPage Schema
How do I remove secrets from git history on GitHub?

Rotate any live credentials first, then scan the repo with gitleaks and custom patterns, create a git bundle backup, and rewrite history with git-filter-repo using a --replace-text replacements file. Verify the cleanup by re-scanning both blob content and commit messages before force-pushing.

git-filter-repo vs BFG Repo-Cleaner for removing secrets?

git-filter-repo is recommended for string replacement of secrets and private domains because it is actively maintained and offers flexible --replace-text rules. BFG is faster on very large repositories and better suited for removing large files, but requires Java.

Does rewriting git history remove a leaked API key?

No, rewriting history does not invalidate an exposed secret. Live credentials must be rotated before cleanup, and public forks retain the old history until their owners sync, so assume anything pushed publicly was seen.

Why does git-filter-repo say it needs a fresh clone?

This error occurs when the repo has multiple remotes or stale refs. Fix it by creating a mirror clone with git clone --mirror and running the rewrite against the mirror instead.

Can I use --no-verify to skip a failing pre-push hook after rewriting history?

No, bypassing hooks is how secrets get pushed. A hook failure after a rewrite usually indicates stale local refs; diagnose and fix the root cause or add an allowlist entry to your gitleaks config instead.