githubversion-controlgithub-cli

I'm unable to run github cli commands because I keep running into an Authentication Error. I'm using the correct username and password. Details below


I'm following the steps listed here to try and link an existing local project to a new repo on GitHub.

I ran gh repo create but got an Authentication error, with a note to update my credentials in the .gitsomeconfig file. I ran gh configure and entered my GitHub username and my GitHub password (since I chose that option instead of using an authentication token). I entered them exactly the same as I type them in. Then I ran gh repo create again and still ran into the Authentication error. I output the content of .gitsomeconfig and verified that the user_login is correct (It doesn't display my password anywhere).

I've tried running gh configureat least 6 times now. I've copied and pasted from Lastpass to be extra sure I'm entering credentials correctly. I've tried both my username and my email address since I wasn't sure which gh configure actually wanted for username, but neither seem to work. I'm at a loss for what might be going wrong. Any thoughts or suggestions?


Solution

  • The right command is gh auth login, using your GitHub account name and your GitHub token (not password, your PAT: Personal Access Token, with scopes "admin:org, gist, repo, user, workflow")

    Then you can check with gh auth status.

    Once the status is clean (authenticated), you can proceed with other commands, like gh repo create.


    Note that "authentication failed" was also be displayed when the remote site timed out. See cli/cli issue 8293.

    This is fixed with gh v2.40.0 and PR 8337.