Check a GitHub repo for secrets and personal info before making it public, and clean it up safely. Scans current files and the full git history for API keys, tokens, Discord webhooks, private keys, .env files, emails, chosen personal words (usernames, real names), commit author emails, image EXIF metadata and huge files, then walks the user through rotating leaked keys and removing personal inf...
Download skill (.zip) Files on GitHubPrivacy check before going public
Once a repo is public, everything in its history is public: deleted files, old commits, pull request descriptions, and Actions logs. Check first. Fixing it afterwards doesn’t un-leak anything.
1. Scan
python3 <skill>/scripts/privacy-scan.py <repo> --term <username> --term "<real name>"
python3 <skill>/scripts/privacy-scan.py <repo> --term yourname --allow 'yourname\.itch\.io' # ignore a pattern
python3 <skill>/scripts/privacy-scan.py <repo> --json
Ask the user which words count as personal (usernames, real name, email, city, studio name)
and pass each as --term. The scanner also checks commit authors, .env files, image metadata,
and files over 50 MB. Values are masked in the output. Never print full secrets in chat.
Also check what the scanner can’t see, through the GitHub API:
curl -s "https://api.github.com/repos/OWNER/REPO/pulls?state=all&per_page=100" | python3 -c \
"import json,sys;[print(p['number'],p['title'],'|',(p['body'] or '')[:200]) for p in json.load(sys.stdin)]"
curl -s "https://api.github.com/repos/OWNER/REPO/issues?state=all&per_page=100" # issues + comments
PR titles and bodies, issues, and comments become public too.
2. Explain the results
| Finding | Risk | What to do |
|---|---|---|
SECRET in files or history |
Anyone can use it | Rotate the key first (make a new one, delete the old one), then remove it |
.env file |
Usually secrets | Rotate what’s inside, add .env* to .gitignore |
EMAIL on commits |
Spam, identity | Switch to the GitHub noreply email (below). Old commits need a rewrite |
TERM in files |
Personal info | Replace with placeholders (yourname) in a normal commit |
TERM / EMAIL “still in history” |
Visible in old commits | History cleanup (step 3), or accept it |
META image metadata |
GPS location, device, name | Strip it: python3 -c "from PIL import Image; im=Image.open(p); im.save(p)" (re-saves without EXIF) |
BIG file |
Push failures, slow clones | Remove, or use Git LFS / a release download |
The repo owner’s username is already public in the repo URL (github.com/<user>/...). Mentions of
it only matter if the user wants the content reusable without their name, or wants a different public account.
3. Clean up (with the user’s OK, because these rewrite history)
Always first: rotate any leaked secret. Rewriting history doesn’t help if someone already copied it.
Then fix the current files in a normal commit (placeholders, .gitignore, stripped images) and run the scan again.
For history, offer these options in plain words and let the user choose:
A. Fresh start in a new repo (cleanest). One commit with today’s files, and no old history, PRs, or refs.
GitHub keeps old PR refs (refs/pull/N/head) even after a force-push, so a new repo is the only way to
guarantee old commits are gone.
- The user creates an empty repo on github.com (or renames the old one to
<name>-oldand keeps it private). -
git switch --orphan public-main && git add -A && git commit -m "First public version" git push https://github.com/OWNER/NEW-REPO.git public-main:main - Re-add secrets, variables, Pages, and branch rules on the new repo, and update links in docs, gists, and skills.
B. Squash the same repo. Same steps but force-push to the existing repo’s main. This needs branch
protection’s “block force pushes” turned off for a moment. Old PRs still show their old commits. Only use it if there were no PRs, or
nothing sensitive in them.
C. Rewrite history with git filter-repo to keep commit history but replace words or drop files:
pip install --user git-filter-repo
printf 'realname==>yourname\nregex:(?i)myusername==>yourname\n' > /tmp/replace.txt
git filter-repo --replace-text /tmp/replace.txt --invert-paths --path .env --force
git filter-repo --mailmap my.mailmap --force # fix author names and emails
Then force-push. It has the same PR-ref caveat as B, and everyone must re-clone.
After any option, run the scan again until it’s clean.
4. Settings to turn on before going public
Tell the user where these are, because the bot’s token can’t change account settings:
- github.com/settings/emails: ✅ Keep my email addresses private and ✅ Block command line pushes
that expose my email. Commit with
ID+username@users.noreply.github.com. - Repo → Settings → Code security: ✅ Secret Protection / Push protection (free for public repos).
- Repo → Settings → Actions → General: require approval for workflows from outside contributors.
Workflows using
pull_requestdon’t get secrets from forks, so keep it that way. Avoidpull_request_target. - Actions logs become public. Make sure no step prints secrets (GitHub masks registered secrets, but not values built from them).
- Gists: “secret” gists are unlisted, not private. Anyone with the link can see them.
- Add a
LICENSEfile (MIT for code, CC BY 4.0 for docs are common) so others know how they can reuse it.
5. Bot rules
- Never print a full secret. Mention its type, file, and the first 4 characters.
- Never force-push, delete branches, or rewrite history without an explicit yes for that specific step.
- Report what you checked and anything still left, for example “history still has your username in 6 old commits. Want a fresh-start repo?”