Skip to content

After updating from release 0.54 to 0.9 I get a 401 Bad credentials problem #1003

Closed

Description

@martinilevi

Describe the bug

I can clone a repo without a problem but gh seems to return a credentials problem.

Steps to reproduce the behavior

  1. Clone a repository with git clone
  2. Change to the created folder
  3. Type "gh checkout pr 1"
  4. I see:
    http error, 'https://api.github.com/graphql' failed (401): 'Bad credentials'

Expected vs actual behavior

I expect the PR #1 branch to be checked out

Logs

$ cd tmp
/tmp$ rm -Rf bin
/tmp$ git clone [email protected]:martinilevi/bin.git
Cloning into 'bin'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 85 (delta 0), reused 2 (delta 0), pack-reused 82
Receiving objects: 100% (85/85), 190.95 KiB | 406.00 KiB/s, done.
Resolving deltas: 100% (34/34), done.
/tmp$ cd bin/
/tmp/bin(master)$ gh pr checkout 1
http error, 'https://api.github.com/graphql' failed (401): 'Bad credentials'
/tmp/bin(master)$ gh --version
gh version 0.9.0 (2020-05-26)
https://github.com/cli/cli/releases/tag/v0.9.0

Activity

  1. billygriffin commented on May 26, 2020

    @billygriffin
    Contributor

    Thanks for the issue @martinilevi and sorry you're having difficulty after upgrading. How did you install gh?

    I'm not sure what in the upgrade might've caused this, but if you want to get back to using it immediately, you can force re-authentication by deleting ~/.config/gh/config.yml and then running any command.

  2. manwaring commented on May 27, 2020

    @manwaring

    I'm having a similar issue - installed 0.9 from gh_0.9.0_linux_amd64.deb. When I try to clone a repo and am prompted to login via the browser:

    • The browser shows me the permissions page, then a success page after I authorize
    • In the terminal gh asks for my username and password, after supplying them it indicates 'invalid username or password'

    Update: I believe the issue was caused by my use of MFA, when I created a new access token for the password prompt in the terminal everything started working

  3. vilmibm commented on May 27, 2020

    @vilmibm
    Contributor

    fwiw, gh itself will never ask for a username and password--when that happens it's git under the hood trying to authenticate.

  4. mislav commented on May 27, 2020

    @mislav
    Contributor

    @martinilevi Let us know if re-authenticating by deleting the config file worked! We plan to improve the user experience around getting the 401 error #627, but for now manual reauthentication is needed.

  5. ribeirojose commented on Jun 3, 2020

    @ribeirojose

    I've had the same issue, and that solution worked great here, @mislav. Thanks!

  6. mislav commented on Jun 3, 2020

    @mislav
    Contributor

    Going to close this as duplicate of #627 where we plan to improve the behavior around getting the 401 error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmore-info-neededMore info needed from user/contributor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions