Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hub create returns 401 error bad credentials on WSL/Ubuntu #2665

Closed
l1chtlaerm opened this issue Dec 9, 2020 · 5 comments
Closed

hub create returns 401 error bad credentials on WSL/Ubuntu #2665

l1chtlaerm opened this issue Dec 9, 2020 · 5 comments
Labels

Comments

@l1chtlaerm
Copy link

react-gifs git:(master) hub create
github.com username: l1chtlaerm
github.com password for l1chtlaerm (never stored):
Error creating repository: Unauthorized (HTTP 401)
Bad credentials. The API cant be accessed using username/password authentication. 
Please create a personal access token to access this endpoint: http://github.com/settings/tokens

I do not have a ~/.config/hub file nor is it created when running hub create. I do have a SSH key for this particular instance. I do not experience this issue on native Ubuntu, but I do experience it on WSL 2 running Ubuntu 18.04. I've also noticed that even after trying to update git and hub separately hub remains as an older version than available. I do not know if this is related to the issue.

react-gifs git:(master) hub --version
git version 2.29.2
hub version 1.12.4

Another thing to note: trying to run hub browse on my own cloned repository throws a 401 "Unauthorized (Net::HTTPServerException) after inputting credentials:

➜  profile git:(master) hub browse
github.com username: l1chtlaerm
github.com password for l1chtlaerm (never stored):
Traceback (most recent call last):
        35: from /home/lichtlaerm/.rbenv/versions/2.6.6/bin/hub:23:in `<main>'
        34: from /home/lichtlaerm/.rbenv/versions/2.6.6/bin/hub:23:in `load'
        33: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/bin/hub:9:in `<top (required)>'
        32: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/runner.rb:17:in `execute'
        31: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/runner.rb:17:in `new'
        30: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/runner.rb:12:in `initialize'
        29: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/commands.rb:63:in `run'
        28: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/commands.rb:687:in `browse'
        27: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/commands.rb:1002:in `browse_command'
        26: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/commands.rb:704:in `block in browse'
        25: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/2.6.0/forwardable.rb:230:in `remote_branch_and_project'
        24: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/context.rb:158:in `remote_branch_and_project'
        23: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/context.rb:158:in `call'
        22: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/commands.rb:870:in `github_user'
        21: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:50:in `username_via_auth_dance'
        20: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:552:in `username'
        19: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:463:in `fetch_value'
        18: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:463:in `fetch'
        17: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:464:in `block in fetch_value'
        16: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:553:in `block in username'
        15: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:54:in `block in username_via_auth_dance'
        14: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:204:in `get'
        13: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:395:in `perform_request'
        12: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:255:in `perform_request'
        11: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:384:in `apply_authentication'
        10: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:329:in `apply_authentication'
         9: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:567:in `oauth_token'
         8: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:463:in `fetch_value'
         7: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:463:in `fetch'
         6: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:464:in `block in fetch_value'
         5: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:568:in `block in oauth_token'
         4: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:330:in `block in apply_authentication'
         3: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:346:in `obtain_oauth_token'
         2: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:346:in `loop'
         1: from /home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:364:in `block in obtain_oauth_token'
/home/lichtlaerm/.rbenv/versions/2.6.6/lib/ruby/2.6.0/net/http/response.rb:122:in `error!': 401 "Unauthorized" (Net::HTTPServerException)
@l1chtlaerm l1chtlaerm added the bug label Dec 9, 2020
@mislav
Copy link
Owner

mislav commented Dec 10, 2020

@l1chtlaerm Sorry for the trouble!

First, you should try updating to the latest version of hub available. Yours is more than 6 years out of date.

If your package manager does not offer the latest version of hub, you can follow our installation instructions to download one manually.

Next, you should go online and generate a Personal Access Token for hub that you will paste in place of a password. #2655

@mislav mislav closed this as completed Dec 10, 2020
@mattevo19
Copy link

I'm having problems using the tokens to log in so trying to update to the latest version https://github.com/github/hub/releases/tag/v2.14.2 on windows ubunto.

I can only manage to get the version 1.12.4 using sudo apt install hub.

@alej37
Copy link

alej37 commented Jan 19, 2021

Hi! I was wondering if you managed to update to the latest version of Hub?? I am having the same issue and even if I get a new token it doesnt work

I'm having problems using the tokens to log in so trying to update to the latest version https://github.com/github/hub/releases/tag/v2.14.2 on windows ubunto.

I can only manage to get the version 1.12.4 using sudo apt install hub.

Hi! I was wondering if you managed to update to the latest version of Hub?? I am having the same issue and even if I get a new token it doesnt work

@mattevo19
Copy link

No sorry, still haven't managed to get it to work.

@LPIX-11
Copy link

LPIX-11 commented Jan 17, 2022

Hello don't know if someone figured it out yet, but this is what worked for me:

First I generated a new personal token on the developer's settings.
I went to the cd ~/.config and changed the content of the hub file

github.com:
- user: [username]
  oauth_token: [generated personal token]
  protocol: https

Saved it, then it worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants