repo-scrub
Scan a GitHub repo's full history for secrets and large files, scrub what the user picks, rewrite history safely, then flip it private → public.
от KrishP147★ 37 звёзд на GitHub
Установить repo-scrub в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Going public is one-way: forks, caches and scrapers copy history within minutes, and GitHub offers no hook on its visibility toggle. So all cleanup happens before the flip, and you flip it yourself with gh.
Two rules hold throughout:
- Gate: each numbered gate below needs the user's explicit go-ahead.
- Complete report: every secret and large blob found is shown, including ones the user keeps.
<tmp> = $(mktemp -d), created once and echoed to the user; reuse that same path in every step (Git Bash's /tmp and Windows %TEMP% differ for Python). <tmp>/scrub-work holds secret-bearing files. Delete it (step 12) on every exit, early ones included.
1. Prereqs and target
gh auth status; else user runsgh auth login.gitleaks version; missing → Windowswinget install --id Gitleaks.Gitleaks -e, mac/linuxbrew install gitleaks. v8.19+ usesgitleaks git; older usesgitleaks detect --source . --log-opts="--all -m".git filter-repo --version; missing →pip install git-filter-repo(mac: or brew). Trust the version command, not pip's exit code: a--userinstall can land off PATH.
Missing tool → give the install command and stop.
<repo> = the argument, else origin's repo per the next skill's BOARD.md, Target repo section (never a bare gh call: on a fork it hits the parent). gh repo view <repo> --json name,owner,isPrivate,defaultBranchRef → confirm the repo, and that a rewrite + force-push is OK if anything gets scrubbed.
In the user's clone:
- Other remotes:
git remote -v; per remote other thanorigin,git ls-remote --heads --tags <remote>. Each is its own copy of the history: its branches are scanned (step 3) and rewritten (step 7), and it gets the rewritten history (step 9, each push on a yes). A branch only there is not local-only. List each remote with its branches. - Submodules:
git log --all -m -p -- .gitmodules | grep -E '^\+\s*url'. Each is a separate repo whose history this scan never enters: tell the user to/repo-scrubeach one before this repo goes public (a private one breaks--recurse-submodulesclones). Flag a relative URL (./,../): it resolves against wherever the superproject was cloned from, so public clones need that sibling repo public at the same path; else use an absolute URL.
2. LFS bail-out
gh api repos/<o>/<r>/contents/.gitattributes --jq .content | base64 -d | grep -i lfs (404 = no LFS). LFS-tracked paths → stop: filter-repo has no LFS awareness; this needs manual handling. This only sees the root file on the default branch, so repeat the check on clone #1 (step 3): git log --all -m -p -- '*.gitattributes' | grep -i filter=lfs catches nested files and other branches. A hit there → stop too.
3. Scan (clone #1)
mkdir -p <tmp>/scrub-work
git clone <url> <tmp>/scan-clone && cd <tmp>/scan-clone
git fetch <remote-url> '+refs/heads/*:refs/remotes/<remote>/*' # per other remote (step 1)
git count-objects -vH > <tmp>/scrub-work/before-size.txt
gitleaks git . --log-opts="--all -m" --report-format json --report-path <tmp>/scrub-work/gitleaks-report.json --no-banner
git filter-repo --analyze
python <skill-dir>/scripts/summarize_findings.py --gitleaks <tmp>/scrub-work/gitleaks-report.json \
--analysis-dir .git/filter-repo/analysis --out <tmp>/scrub-work/findings.json
- Run the LFS history check from step 2 here, in
scan-clone, before trusting the scan. - gitleaks exit 1 = findings, not failure.
-mon--log-optsand on everygit log -S/--grephere and in step 8: without it a change made only in a merge commit (a conflict resolution) is never diffed, so a secret added there scans clean.summarize_findings.pymerges gitleaks +.git/filter-repo/analysis/intofindings.json: secretsS1…(deduped by rule + value, or by location when the value is empty; fingerprintsecret_sha256only), large blobsL1…(bytes accumulated across every version). Use it; the analysis tables are easy to misread.- Personal strings (names, emails) from
/repo-showcaseor the user: gitleaks has no rule for them. Per string,git log --all -m -S'<string>' --oneline(blob hits) andgit log --all -m -F -i --grep='<string>' --oneline(commit-message hits). Each hit is a findingP1…(Detail:personal string, plus the commit count); refer to it by ID from here on. - Identities and messages:
git log --all --format='%an %ae %cn %ce%n%B' | grep -Eo '[[:alnum:]._%+-]+@[[:alnum:].-]+\.:alpha:+' | sort -uandgit log --all --format='%an <%ae>%n%cn <%ce>' | sort -u. Drop the owner's own (ask). Each other email is checked as a personal string; each other author/committer identity is aPfinding (Detail:author identity), unless/repo-showcasehanded over "author identities stay". - Signatures:
git log --all --format='%h %G?' | grep -v ' N$'(signed commits) andgit for-each-ref refs/tags --format='%(if)%(contents:signature)%(then)%(refname:short)%(end)'(signed tags). filt
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- POST-PUSH.md
- README.md
- ROTATE.md
- scripts/build_replace_text.py
- scripts/summarize_findings.py
- scripts/test_build_replace_text.py
- scripts/test_summarize_findings.py
FAQ
Что делает скилл repo-scrub?
Scan a GitHub repo's full history for secrets and large files, scrub what the user picks, rewrite history safely, then flip it private → public.
Как установить скилл repo-scrub?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл repo-scrub запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…