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

Unable to authorize GitHub password (Unathorized/Not Found) #2655

Open
flyingduck92 opened this issue Nov 28, 2020 · 42 comments
Open

Unable to authorize GitHub password (Unathorized/Not Found) #2655

flyingduck92 opened this issue Nov 28, 2020 · 42 comments
Labels

Comments

@flyingduck92
Copy link

flyingduck92 commented Nov 28, 2020

I already put an alias for hub on my
.bashrc
alias git=hub

But when I want to create a repos my credentials always failed

Command attempted:
git create jam_hub
github.com username: flyingduck92
github.com password for flyingduck92 (never stored):

What happened:
Error creating repository: Unauthorized (HTTP 401)
Bad credentials. The API can't be accessed using username/password authentication. Please create a personal access token to access this endpoint: http://github.com/settings/tokens

More info:
git version 2.29.1.windows.1
hub version 2.14.2

@amichaelc
Copy link

I had the same issue. I went to the github tokens link provided and made a token, and now it works.

@mislav
Copy link
Owner

mislav commented Nov 30, 2020

I'm sorry for the inconvenience. GitHub deprecated its Authorizations API, which hub relied on for exchanging a password for a token.

Until we fix this in hub, the solution is to generate a Personal Access Token (with at least repo scope) at https://github.com/settings/tokens and paste it instead of the password.

@mislav mislav pinned this issue Nov 30, 2020
@flyingduck92
Copy link
Author

I'm sorry for the inconvenience. GitHub deprecated its Authorizations API, which hub relied on for exchanging a password for a token.

Until we fix this in hub, the solution is to generate a Personal Access Token (with at least repo scope) and paste it instead of the password.

Oh okay, I will try usng Personal Access Token then.
Cheers sir

@dominguespt
Copy link

Hello, I uninstalled hub gem and did the update wit Homebrew

@mislav mislav changed the title hub failed to gives access after inserting username and password Unable to authorize with my GitHub password (Unathorized/Not Found) Dec 15, 2020
@JavaProScript
Copy link

I'm sorry for the inconvenience. GitHub deprecated its Authorizations API, which hub relied on for exchanging a password for a token.

Until we fix this in hub, the solution is to generate a Personal Access Token (with at least repo scope) at https://github.com/settings/tokens and paste it instead of the password.

This didn't fix it for me. Error stays the same. I will try to find a fix.

@ketankshukla
Copy link

I'm sorry for the inconvenience. GitHub deprecated its Authorizations API, which hub relied on for exchanging a password for a token.

Until we fix this in hub, the solution is to generate a Personal Access Token (with at least repo scope) at https://github.com/settings/tokens and paste it instead of the password.

You have NO idea how much I searched the internet to find this solution! THANK YOU!

@carlosloureda
Copy link

I'm sorry for the inconvenience. GitHub deprecated its Authorizations API, which hub relied on for exchanging a password for a token.

Until we fix this in hub, the solution is to generate a Personal Access Token (with at least repo scope) at https://github.com/settings/tokens and paste it instead of the password.

Thanks @mislav. That worked for me!

@alk-gmathews
Copy link

alk-gmathews commented Feb 4, 2021

I'm sorry for the inconvenience. GitHub deprecated its Authorizations API, which hub relied on for exchanging a password for a token.

Until we fix this in hub, the solution is to generate a Personal Access Token (with at least repo scope) at https://github.com/settings/tokens and paste it instead of the password.

This information should be in the readme, and not in an issue.

@leo60228
Copy link

leo60228 commented Feb 8, 2021

Why was this issue closed? This seems like a pretty major issue.

@mislav
Copy link
Owner

mislav commented Feb 19, 2021

True— it's not solved yet, so I'm reopening.

@mislav mislav reopened this Feb 19, 2021
@bharath-123
Copy link

bharath-123 commented Feb 21, 2021

@mislav Can we change the intimation message until this is fixed? Something like github.com token for <user>: rather than github.com password for <user>: ? I think the message is fairly confusing.

bharath-123 added a commit to bharath-123/community that referenced this issue Feb 21, 2021
Recently, I performed a cherry pick for the first time. When I ran ./hack/cherry_pick_pull.sh
after setting up all the env variables, I was asked for my github password. When I gave my actual
github password it threw a 404 not found which confused me. I then came across this
mislav/hub#2655 (comment) . I created a github token
post which I was able to cherry pick successfully.

The hub project team is looking to fix it but until then I feel that we should document it.

Do let me know if I did something wrong here in the cherry pick process.
@leonardodimarchi
Copy link

leonardodimarchi commented Feb 24, 2021

Is there a way to change the message, just like @bharath-123 said ?

@mislav Can we change the intimation message until this is fixed? Something like github.com token for <user>: rather than github.com password for <user>: ? I think the message is fairly confusing.

I was hoping that we could save the token somewhere too, is that possible ?

Edit: Found this on Hub Configurations

Hub will prompt for GitHub username & password the first time it needs to access the API and exchange it for an OAuth token, which it saves in ~/.config/hub.

To avoid being prompted, use GITHUB_USER and GITHUB_PASSWORD environment variables.

Alternatively, you may provide GITHUB_TOKEN, an access token with repo permissions. This will not be written to ~/.config/hub.

@leonardodimarchi
Copy link

Repo successful created with the token, but when i try to git push origin master, i get git@github: permission-denied.

@jamiecropley
Copy link

Repo successful created with the token, but when i try to git push origin master, i get git@github: permission-denied.

if your trying to push with git could most likely be a setting there. Do you have it set up for https or ssh?

@leo60228
Copy link

leo60228 commented Mar 1, 2021

Since it doesn't seem to have been posted here, GitHub added an OAuth flow that doesn't need a web browser/server: https://docs.github.com/en/developers/apps/authorizing-oauth-apps#device-flow

@jamiecropley
Copy link

Since it doesn't seem to have been posted here, GitHub added an OAuth flow that doesn't need a web browser/server: https://docs.github.com/en/developers/apps/authorizing-oauth-apps#device-flow

I just always do SSH as I know how to get it working, however I ended up here as I completely forgot about the token thing, they really need to update the word password to token really.

@nelsonov
Copy link

nelsonov commented Mar 3, 2021

Why did Git do something that would break a common workflow without first providing a fix for that workflow? Sounds a lot like something Microsoft would do...

@leonardodimarchi
Copy link

Repo successful created with the token, but when i try to git push origin master, i get git@github: permission-denied.

if your trying to push with git could most likely be a setting there. Do you have it set up for https or ssh?

I'm using https

@Cindywritescode
Copy link

I'm sorry for the inconvenience. GitHub deprecated its Authorizations API, which hub relied on for exchanging a password for a token.

Until we fix this in hub, the solution is to generate a Personal Access Token (with at least repo scope) at https://github.com/settings/tokens and paste it instead of the password.

It works !!! Thank you so much ❤️

@shubhampathak09
Copy link

I am facing a similar issue, in past whenever i did git push origin master on the new repo using git bash, it prompted me with a username and password screen, where in pwd i used to enter PAT, and things would just work fine. But this time gitbash is not prompting me with username and password.

@Overdozed
Copy link

i has to change url to https inside .git/config in order to get it up and running
[remote "origin"]
url = https://github.com/...

@fuji246
Copy link

fuji246 commented Nov 3, 2021

Access Token stops working...

@davidblum
Copy link

I was able to get this working by generating a PAT per the linked docs, and then setting up a hub config file in: ~/.config/hub:

github.com:
- user: < user_name >
  oauth_token: < PAT >
  protocol: https

@ystraore
Copy link

I am trying to push a file in Github. I was able to pass in my username, but unable to put my token password. I did not see the little window that asks for my password I just see a little key picture. I will appreciate if someone can help me with that.

@pcobos
Copy link

pcobos commented Dec 29, 2021

This wasted me some time so I want to write down the solutions. If you have time to switch to gh, do it, otherwise:

  • Generate PAT (with repo scope)
  • Create a ~/.config/hub file like below (per mislav's comment). Put in your username as user and paste your PAT on oauth_token.
    github.com:
     - user: mislav
       oauth_token: PASTE_YOUR_TOKEN_HERE
       protocol: https
    
  • Try hub clone

I tried this but I am getting the following error

.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:511:in block in yaml_load': undefined method []=' for nil:NilClass (NoMethodError)

I tried reinstalling the gem to no avail, any suggestions?

@mislav
Copy link
Owner

mislav commented Jan 3, 2022

@pcobos You seem to be using the hub Ruby gem, which last had a release in 2014 and was since rewritten in Go and released through this project's Releases page. You should upgrade!

@tomoat
Copy link

tomoat commented Jan 13, 2022

Use gh instead of hub, https://github.com/cli/cli

> brew install gh
> gh auth login
> gh repo create 

@gambas-maker
Copy link

Hello, I'ma facing this issue, I removed ~/.config/hub then I did hub create
But now I'm having this error :
Error creating repository: Not Found (HTTP 404)

Do you have an idea ?

@Betristor
Copy link

They really not?

image

@timmattison
Copy link

Please, please, please get rid of this tool if it is no longer supported. I just wasted 30 minutes trying to get a previously working setup up and running and ended up here at the bottom of this rabbit hole.

It is fine if the tool needs a token, it is fine if the tool is discontinued, but do your best to surface this to users running the latest version as fast as possible.

If the tool is to continue to be available my suggestions are below.

Not found could be replaced with:

Not found. Are you trying to use a username and password?

Until we fix this in hub, the solution is to generate a Personal Access Token (with at least repo scope) at https://github.com/settings/tokens and paste it instead of the password.

And when it says this:

Error fetching pull requests: Unauthorized (HTTP 401)
Bad credentials

It would be better to say:

Error fetching pull requests: Unauthorized (HTTP 401)
Bad credentials

Try clearing out your ~/.config/hub file. Your next attempt to connect with request that you reauthorize.

smortex added a commit to smortex/hub that referenced this issue Mar 25, 2022
According to [this comment][ref], the usage of a password is currently
broken but it is possible to pass an access token instead.

This access token is then stored in the configuration file, so adjust
the message to ask for an access token, tell the user where then can
generate a new one, provide the required scope, and do not tell that the
value is not stored.

[ref]: mislav#2655 (comment)
bobwhitelock added a commit to bobwhitelock/dotfiles that referenced this issue May 3, 2022
GitHub CLI is an official project whereas `hub` isn't (did it used to
be?), GitHub CLI seems more fully featured and a drop in replacement for
usage in `clone`, just using GitHub CLI replaces 2 dependencies with
just 1, and GitHub CLI worked out of the box on a new machine, whereas
`hub` was giving an obtuse error that I couldn't easily resolve (see
mislav/hub#2655).
@aamruth
Copy link

aamruth commented Aug 5, 2022

git:(master) hub create
github.com username: blabla
github.com password for blabla (never stored):
Error creating repository: Not Found (HTTP 404)

Tired using the token too, still got the same error

Smona added a commit to Smona/nixpkgs that referenced this issue Oct 7, 2022
I couldn't get hub to authenticate properly, because it hasn't been
updated to support github's new auth APIs. Most people recommended
switching to gh: mislav/hub#2655
@NdagiStanley
Copy link

NdagiStanley commented Oct 11, 2022

Using the PAT (Personal Access Token) with repo scope as the password works for me.

@TimCookXXX
Copy link

Извините за неудобства. GitHub устарел от своего API авторизации, на который хаб полагался при обмене пароля на токен.

Пока мы не исправим это в хабе, решение состоит в том, чтобы сгенерировать токен личного доступа (по крайней мере, с repoобластью действия) на https://github.com/settings/tokens и вставить его вместо пароля.

It works, thanks!
But if you didn't select 'Repo' when creating the key, then you get the following error:
Error creating repository: Unauthorized (HTTP 401) Bad credentials
You need to delete the ~/.config/hub directory and re-authorize on github.com and everything should work fine.
rm -rf ~/.config/hub
And after that, authorize again by entering your login and the key that you previously created:
hub create

@Klairm
Copy link

Klairm commented May 7, 2023

Using the PAT (Personal Access Token) with repo scope as the password works for me.

I'm trying to use a token for password but it doesn't work for me

r-hang added a commit to thriftrw/thriftrw-go that referenced this issue Jun 9, 2023
The current RELEASE.md relies on the `hub` command. I ran into authorization
issues while trying to use `hub` for the release that were not easy to
resolve. The problems I encountered are captured in a still open `hub`
issue: mislav/hub#2655. Given the extra steps
required to work around and resolve this issue, I think it would be
simpler to frame the release instructions in terms of local `git`
commands and Github UI.

This change updates the RELEASE.md to replace `hub` commands with local
`git` commands and Github UI instructions.
r-hang added a commit to thriftrw/thriftrw-go that referenced this issue Jun 13, 2023
The current RELEASE.md relies on the `hub` command. I ran into authorization
issues while trying to use `hub` for the release that were not easy to
resolve. The problems I encountered are captured in a still open `hub`
issue: mislav/hub#2655. Given the extra steps
required to work around and resolve this issue, I think it would be
simpler to frame the release instructions in terms of local `git`
commands and Github UI.

This change updates the RELEASE.md to replace `hub` commands with local
`git` commands and Github UI instructions.
@nh2
Copy link

nh2 commented Nov 5, 2023

I just wasted 30 minutes trying to get a previously working setup up and running and ended up here at the bottom of this rabbit hole.

It is fine if the tool needs a token, it is fine if the tool is discontinued, but do your best to surface this to users running the latest version as fast as possible.

Same here.

@mislav Could you please make the tool emit an error, instead prompting for username and password and saying Not Found, when it's known that this cannot currently work?

nh2 added a commit to nh2/nixos-configs that referenced this issue Nov 5, 2023
@flyingduck92 flyingduck92 changed the title Unable to authorize with my GitHub password (Unathorized/Not Found) Unable to authorize GitHub password (Unathorized/Not Found) Mar 14, 2024
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