Route git-https to the right GitHub account per org path - #17
Merged
Conversation
The Xcode CLT system gitconfig hardwires the osxkeychain credential helper, which answers github.com HTTPS requests with whichever account last cached a credential. When that's the personal account, background tooling (Claude Code's plugin marketplace updater) clones private work repos as the wrong user, gets "repository not found", and tears down its cache. Fix mirrors the gh() wrapper's per-owner pinning for plain git: reset the helper list for github.com and pin usernames per org path (useHttpPath). A new ~/bin/git-credential-gh-user helper serves the pinned account's token straight from gh's keyring — gh's own helper only answers for the active account, so it can't do this — and remains the fallback for unpinned URLs. Tokens never touch disk; mac machine class only. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
osxkeychain, which answers github.com HTTPS with whichever account last cached a credential — background tooling (Claude Code's plugin marketplace updater) then cloned private work repos as the personal account, got "repository not found", and tore down its marketplace cache, silently disabling every work plugin.~/bin/git-credential-gh-user, a small credential helper that serves the token for the username git requests, straight from gh's keyring (gh auth token --user); gh's bundled helper only answers for the active account, so it can't do this.dot_gitconfig.local.tmpl(mac class only) resets the github.com helper list to: the new helper, thengh auth git-credentialas fallback, withuseHttpPathand per-org-pathusernamepins. Plain-git behavior for unpinned URLs is unchanged (active gh account). No tokens at rest anywhere.Test plan
git credential fillwith a work-org path resolves the work username + token while the personal account is active; a personal path still resolves to the personal accountclaude plugin marketplace updatenow succeeds bare, no env-var token injectionbats testspasses🤖 Generated with Claude Code