Skip to content

Fix auth git-credential when the token comes from environment#3009

Merged
mislav merged 1 commit intotrunkfrom
git-credential-env
Feb 23, 2021
Merged

Fix auth git-credential when the token comes from environment#3009
mislav merged 1 commit intotrunkfrom
git-credential-env

Conversation

@mislav
Copy link
Contributor

@mislav mislav commented Feb 22, 2021

When a token such as GH_TOKEN is set through environment variables and ~/.config/gh/hosts.yml is non-existent, the auth git-credential get command used to fail due to missing username.

Since GitHub username isn't at all required for token authentication, use the x-access-token faux username instead of trying to obtain one from a config file.

Fixes #2708 (comment)

When a token such as GH_TOKEN is set through environment variables and
`~/.config/gh/hosts.yml` is non-existent, the `auth git-credential get`
command used to fail due to missing username.

Since GitHub username isn't at all required for token authentication,
use the `x-access-token` faux username instead of trying to obtain one
from a config file.
@mislav mislav requested a review from a team February 22, 2021 13:45
@mislav mislav merged commit c5af4dd into trunk Feb 23, 2021
@mislav mislav deleted the git-credential-env branch February 23, 2021 15:32
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.

Flag support for passing github username and password for creating repo

3 participants