Skip to content

Wire git's credential helper to gh - #109

Closed
alycda wants to merge 1 commit into
mainfrom
claude/pr-107-semantic-review-q1wjgz
Closed

Wire git's credential helper to gh#109
alycda wants to merge 1 commit into
mainfrom
claude/pr-107-semantic-review-q1wjgz

Conversation

@alycda

@alycda alycda commented Aug 17, 2026

Copy link
Copy Markdown
Owner

gh auth login stores a token in ~/.config/gh/hosts.yml for gh's own use
and never touches git config, so git had no credential helper at all. An
https push fell through to git's username/password prompt, which GitHub
disabled for git operations in 2021 — leaving a green gh auth status
sitting next to a failing git push. Colocated jj repos fail the same
way: jj git push shells out to git and inherits the empty config.

gh auth setup-git is the usual fix and is wrong here. It writes with
--global, which resolves through the home-manager symlink into a
/nix/store path. The write succeeds (the store is writable in the
container image) and is silently reverted by the next activation — a
push that works until the next rebuild and then stops, with nothing
explaining why. Config home-manager owns has to come from home-manager.

The helper names gh by absolute store path rather than relying on PATH:
git runs it with whatever PATH it inherited, and the nix profile isn't
on PATH in every non-interactive context. gh is already in
lib/core-packages.nix, so this adds nothing to the closure.

Co-Authored-By: Claude Opus 5 noreply@anthropic.com

`gh auth login` stores a token in ~/.config/gh/hosts.yml for gh's own use
and never touches git config, so git had no credential helper at all. An
https push fell through to git's username/password prompt, which GitHub
disabled for git operations in 2021 — leaving a green `gh auth status`
sitting next to a failing `git push`. Colocated jj repos fail the same
way: `jj git push` shells out to git and inherits the empty config.

`gh auth setup-git` is the usual fix and is wrong here. It writes with
--global, which resolves through the home-manager symlink into a
/nix/store path. The write succeeds (the store is writable in the
container image) and is silently reverted by the next activation — a
push that works until the next rebuild and then stops, with nothing
explaining why. Config home-manager owns has to come from home-manager.

The helper names gh by absolute store path rather than relying on PATH:
git runs it with whatever PATH it inherited, and the nix profile isn't
on PATH in every non-interactive context. gh is already in
lib/core-packages.nix, so this adds nothing to the closure.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@alycda alycda closed this Aug 17, 2026
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