Skip to content

Route git-https to the right GitHub account per org path - #17

Merged
hadees merged 1 commit into
masterfrom
fix/gh-credential-routing
Jul 22, 2026
Merged

Route git-https to the right GitHub account per org path#17
hadees merged 1 commit into
masterfrom
fix/gh-credential-routing

Conversation

@hadees

@hadees hadees commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • The Xcode CLT system gitconfig hardwires 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.
  • Adds ~/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, then gh auth git-credential as fallback, with useHttpPath and per-org-path username pins. Plain-git behavior for unpinned URLs is unchanged (active gh account). No tokens at rest anywhere.

Test plan

  • shellcheck clean on the helper
  • git credential fill with a work-org path resolves the work username + token while the personal account is active; a personal path still resolves to the personal account
  • The previously-failing claude plugin marketplace update now succeeds bare, no env-var token injection
  • bats tests passes

🤖 Generated with Claude Code

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>
@hadees hadees self-assigned this Jul 22, 2026
@hadees
hadees merged commit b9b8359 into master Jul 22, 2026
@hadees
hadees deleted the fix/gh-credential-routing branch July 22, 2026 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant