Allow gh auth git-credential get
to get a token for non-active user
#9111
Labels
gh auth git-credential get
to get a token for non-active user
#9111
Describe the feature or problem you’d like to solve
Currently
gh auth git-credential get
can get a token for only active account in specified host.e.g.
I think that
gh auth git-credential get
should be able to get a token regardless of whether user is active or not if the specific username is given.Proposed solution
This enhancement will allow developers to control credentials by remote url (such as
https://emiksk@github.com/org/repo
andhttps://non-emiksk@github.com/org/repo
) instead of usinggh auth switch
.Additional context
This behavior is caused by using
ActiveToken()
method in helper.go even if a username is given.It would be better to use the
TokenForUser()
method when username is given, as in token.go.However,
TokenForUser()
method ignores environment variables such asGITHUB_TOKEN
unlikeActiveToken()
method.cli/internal/config/config.go
Lines 448 to 458 in 140edf7
cli/internal/config/config.go
Line 203 in 140edf7
Therefore, if the logic of token.go and helper.go are simply made common, a behavior is changed when an environment variable exists and username is explicitly given.
Since this behavior also exists in the test case, it needs to consider whether the behavior should be changed or whether different logic should be implemented instead of sharing the same logic.
The text was updated successfully, but these errors were encountered: