git-commit-identity-privacy

Use when a commit may leak a personal email; audit and fix.

Qu'est-ce que git-commit-identity-privacy ?

git-commit-identity-privacy is a Claude Code agent skill that use when a commit may leak a personal email; audit and fix.

Compatible avec~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/YMX-FP/git-commit-identity-privacy/tree/HEAD

Installed? Explore more Développement et programmation skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

Demander à votre IA préférée

Ouvre une nouvelle conversation avec cette compétence d'agent déjà préchargée.

Documentation

Commit identity privacy audit

Self-contained procedure pack: a markdown procedure plus shell and Python helpers. It talks to git, gh, and the host's public HTTP API only — no agent-specific APIs and no runtime to install beyond gh and Python 3, so any agent (or a plain terminal) can follow it end to end.

When to Use

Check whether a person's real email / name / identifiers leak through git commit metadata, prove the exposure, and fix it without overpromising. Use when the user asks "am I leaking my email on GitHub/Gitee/cnb.cool", "check my commits", "clean my commit author", or right after a history rewrite (to confirm the rewrite left no other flagged address behind).

Model you must reason with (three surfaces)

Identity in a commit comes from three independent places. Fixing one does not fix the others — always state which ones are covered:

SurfaceControls itHow to detect
Per-repo .git/config user.emailrepo configgit -C <repo> config --get user.email
Global ~/.gitconfig user.emailmachine defaultgit config --global --get user.email (empty = commit fails rather than leaking)
Host web-UI commit-email pickerthe host's "keep my email private" settingsettings page, or a web-made commit's committer

The dangerous case is a web-UI commit whose committer is the host's bot (GitHub <[email protected]>) but whose author email is a real address: local git config never touched it, so machine-side checks report clean.

Core rules (always on)

  • A push publishes identity permanently. Every pushed commit carries author and committer name+email in immutable history; forks and archive crawlers copy it within minutes. State this before recommending any fix.
  • Never conclude "no leak" from a local scan. Local repos only show what was pushed from THIS machine. Name the unscanned surface: other machines, deleted repos, forks, gists, other hosts.
  • An empty user.email is safe-by-failure, not safe-by-policy: git commit errors out instead of leaking. Report it as a setup gap, not a leak.
  • Prefer the ID-based noreply <id>+<login>@users.noreply.github.com (gh api user --jq '.id, .login'). Legacy <login>@users.noreply.github.com detaches from the account if the login changes.
  • History rewrite is not future safety. A rewrite fixes one commit's author; it does not change the three surfaces above. Say this in the same breath as recommending the rewrite, never only after the user asks.
  • Rewriting is gated on explicit user approval, with consequences named: SHA churn, broken clones/open PRs, old objects still addressable by direct SHA until the host GCs or support purges them, already-scraped copies irreversible. Offer delete-and-recreate as the thorough alternative plus its cost (stars/watch/issues/links).
  • Prove exposure before calling it a leak: an unauthenticated read returns the address (see Verification). "It is in the history" is weaker than "an anonymous user can read it right now".
  • Report shape: conclusion first (leak yes/no, how many), then a table, then an options table with the recommended option first. Answer in the user's language.

Branch points (decide explicitly, in this order)

Eight forks change everything downstream. Never skip one silently — state which branch was taken in the report.

#ForkBranchAction
G1Host accessgh installed + authedscan all repos incl. private (repo scope)
account exists, gh missingask before installing; if refused, public API only (60 req/h) and the report says "private not covered"
no account / no consentlocal-only recon; first line of the report says "account surface not covered"
G2Scan depthrepo ≤100 commits--paginate full history
large repo / rate-limit riskdrop --paginate, last 100 only, report says "partial"
offlinegit clone --bare --filter=blob:none + git log --all
G3Classifier resultall safe_*skip rewrite, go to G5 (harden future only)
any flag_personal / flag_schoolprove with the anonymous curl, then G4
flag_other_domain / unknownask whether the address is the user's before calling it a leak
G4Which surface leakedlocal git configfix global or repo-level user.email
web-UI commit (committer GitHub <[email protected]>)local config is irrelevant; only the two account toggles + the web email picker matter
other machine / fork / deleted reponot recoverable; list as an uncontrolled surface
G5Identity scopeGitHub onlyglobal ID-form noreply
also pushes to cnb.cool / Gitee / GitLabper-repo override, or global with the side effect stated
G6History cleanup (needs explicit yes)few commits, 0 forksgit filter-repo + force-push (cheapest)
many references, must be gone nowdelete and recreate the repo (loses stars/watch/issues/links)
user refuses destructive stepskeep history, harden only
any branchgit bundle backup first; compare tree SHA after the push
G7Orphaned objectold SHA still HTTP 200draft a [email protected] email — do NOT force the Private Information Removal form (its premise is third-party posting; honest answers route to DMCA, dishonest ones are a lie)
repo recreatednothing left; skip
residual risk acceptedrecord "not handled" plus the reason
G8Other hostsGitHub onlydone
cnb.cool / Gitee presentscan each host separately; noreply addresses are per-host

Two rules hold across every branch: a clean local scan proves nothing about the account, and a config change never cleans history.

Procedure

1. Pin the host identity

gh auth status                      # scope needs repo for private repos
gh api user --jq '.login, .id, (.email // "null")'

email: null means the public profile hides the address — it says nothing about commit metadata. Never treat it as a clean bill.

2. Local scan (this machine)

for r in <repo dirs>; do
  echo "== $r"; git -C "$r" remote -v; git -C "$r" rev-list --all --count
  git -C "$r" config --get user.email
  git -C "$r" log --all --format='%ae' | sort | uniq -c | sort -rn
done

A per-repo address is how a "clean" global config still leaks.

3. Remote scan (every repo of the account, private included)

scripts/scan_commit_emails.sh remote <out.tsv> — lists repos with gh repo list --limit 400, pages every commit, emits TSV repo, sha, author_login, author_name, author_email, committer_email. For repos already on disk on any host: scripts/scan_commit_emails.sh local <out.tsv> <repo dir> ...

4. Classify and report

python scripts/classify_commit_emails.py <out.tsv> -o reports/commit-email-audit.md
echo "exit=$?"   # 0 = no flag_* email, 2 = at least one

Buckets: safe_noreply, safe_bot, safe_local, flag_personal, flag_school, flag_other_domain, unknown. Personal providers and .edu. domains always warrant a flag; @users.noreply.github.com, noreply@<host>, @localhost do not. The report also lists commits whose author login is -: those emails are unlinked, so they render verbatim.

5. Verify the flag is publicly readable

curl -s "https://api.github.com/repos/<owner>/<repo>/commits/<sha>" \
  | grep -o '"email": *"[^"]*"' | head -4
curl -s -o /dev/null -w "HTTP %{http_code}\n" "https://github.com/<owner>/<repo>"

Email in the anonymous response + HTTP 200 = real exposure. Put both in the report; that is the line that moves a user to act.

6. Host settings (not readable by API)

The two GitHub toggles sit at https://github.com/settings/emails: Keep my email addresses private and Block command line pushes that expose my email. No endpoint exposes them — ask the user to look and leave the field pending rather than guessing.

7. Remediation

references/remediation.md has the config fix, the git-filter-repo recipe (bundle backup before rewrite, tree-SHA equality check after force-push), and the residual-risk table. Sequence: fix the future first (config + settings), then propose history cleanup. After a force-push, re-verify the old SHA with an anonymous curl: HTTP 200 means it is still readable. GitHub offers no purge form that fits self-exposure — the Private Information Removal intake is premised on a third party posting your data (answering "yes, this is my own work" diverts to the DMCA flow; answering "no" is a false statement), the privacy form dead-ends at a mailto, and the repository support categories have no matching topic. So write the user a ready-to-send email to [email protected] (repo URL, full old SHA, what you rewrote, the still-200 URLs, the ask) instead of driving a form to a false premise. External actions need sign-off first; state that the residual only matters to someone who already holds the old SHA.

Pitfalls

  • In a git worktree .git is a file, so .git/info/exclude fails with "Not a directory". Resolve with EXC="$(git rev-parse --path-format=absolute --git-common-dir)/info/exclude".
  • Write audit outputs into a path excluded via info/exclude, not .gitignore. The raw TSV holds the very addresses being audited; a local exclude keeps it out of the repo without touching tracked project config.
  • gh api --jq runs its own jq — no jq binary needed; keep filters inline instead of piping to a tool that may be missing.
  • --paginate costs one request per 100 commits. On a repo with thousands of commits, drop --paginate for a fast last-100 pass and call the scan partial.
  • Empty repos return 409 on the commits endpoint. Use set -uo pipefail (not -e) in the loop and count skips, or the first empty repo kills the whole scan.
  • Spot-check completeness per repo: gh api "repos/<o>/<r>/commits?per_page=100" --jq 'length' must equal grep -c "^<o>/<r><TAB>" <out.tsv> when that repo has ≤100 commits.
  • cnb.cool / Gitee leak the same way. A public cnb.cool repo answers an unauthenticated curl; do not narrow the audit to GitHub just because that is where the user pointed.
  • Do not re-paste collected addresses into chat; the file is the artifact, the message carries the count and the SHA.

Done means

  • Every flagged email has a verified anonymous read (step 5) or is explicitly marked unverifiable.
  • The report states which of the three surfaces is fixed and which is pending.
  • Settings toggles are recorded as confirmed-by-user or pending, never assumed.
  • Any history rewrite has an explicit approval line or was left untouched.

Skills associés