Repository navigation
Conversation
|
Thanks for your pull request! Unfortunately, it doesn't meet the requirements for review:
Please update your PR to address the above. This PR will be automatically closed in 4 days if these requirements are not met. Full contribution requirements
|
There was a problem hiding this comment.
Pull request overview
Adds support for selecting a specific configured GitHub account when gh auth git-credential get is used as a git-credential helper, addressing the inability to retrieve tokens for non-active accounts.
Changes:
- Add
--accountflag togh auth git-credentialto request credentials for a specific username. - Use
TokenForUserfor account-scoped token lookup (includinggist.host normalization). - Extend git-credential helper tests with
--accountscenarios.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pkg/cmd/auth/gitcredential/helper.go | Adds --account flag and token lookup path using TokenForUser |
| pkg/cmd/auth/gitcredential/helper_test.go | Adds unit tests for --account behaviors |
Comments suppressed due to low confidence (1)
pkg/cmd/auth/gitcredential/helper.go:130
- In the
--accountpath, a missing token results in a new error message (account %q not found...). Elsewhere in this helper, “no credentials available” cases returncmdutil.SilentErrorto avoid printing anything to stderr. To keep git-credential behavior consistent and quiet, consider returningcmdutil.SilentErrorhere (and only error loudly for truly exceptional conditions).
gotToken, _, tokenErr := cfg.TokenForUser(tokenLookupHost, opts.Account)
if tokenErr != nil {
return fmt.Errorf("gh auth git-credential: account %q not found on %s", opts.Account, lookupHost)
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Exempt x-access-token username from --account mismatch check - Add tests for --account with gist host and x-access-token username
This comment was marked as spam.
This comment was marked as spam.
|
Closing due to contribution guidelines (no help wanted label) + I don't think myself and the other maintainers have agreed on the approach for this problem space. |
Fixes #9111
To use specified account for git-credential:
~/.gitconfig:
~/work/.gitconfig: