← ClaudeAtlas

craft-repo-identitylisted

Binding one repository to one GitHub account when a machine holds several. Which identity signs a commit, which token pushes it, and why the CLI's account is global when everything else is per repo.
attac-t/the-foundry · ★ 1 · Code & Development · score 57
Install: claude install-skill attac-t/the-foundry
# Skill: Craft Repo Identity > "One machine, many accounts. The repository says which. Nothing else gets a vote." ## When Two GitHub accounts on one machine — work and personal, client and self. The global git identity is right for one of them and silently wrong for the rest. A commit signed by the wrong account still lands, and nobody is asked. ## The Standard Every binding is `--local`. The global one stays whatever it was; each repo overrides it. ```bash git config --local user.name "Full Name" git config --local user.email "<id>+<user>@users.noreply.github.com" git config --local github.account "<user>" git remote set-url origin "https://<user>@github.com/<owner>/<repo>.git" ``` Three jobs, and only the first two are git's: | Binding | Decides | |---|---| | `user.email` | Who the commit is attributed to | | Username in the remote URL | Which account git asks the credential helper for | | `github.account` | What the sync hook reads | `<id>` comes from `gh api user --jq .id` — a bare `<user>@users.noreply.github.com` will not attribute. `.name` is often null, so set `user.name` by hand rather than piping a blank in. ## The Global One Everything above is per repo. **The CLI's active account is not.** `gh auth git-credential` answers only for whoever is active, so `git push` fails in a repo the CLI is not pointed at. Not `gh push`. Plain `git`. Check a repo before trusting it: ```bash git credential fill <<< "url=$(git config remote.origin.url)" ``` A password m