Wire git's credential helper to gh - #109
Closed
alycda wants to merge 1 commit into
Closed
Conversation
`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>
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.
gh auth loginstores a token in ~/.config/gh/hosts.yml for gh's own useand 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 statussitting next to a failing
git push. Colocated jj repos fail the sameway:
jj git pushshells out to git and inherits the empty config.gh auth setup-gitis 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