hub: Unable to authorize with my GitHub password (Unathorized/Not Found)
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
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 14
- Comments: 42 (3 by maintainers)
Commits related to this issue
- Add docs about github tokens for cherrypicking 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... — committed to bharath-123/community by bharath-123 3 years ago
- Ask for a token, not a password According to [this comment][1], 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 th... — committed to smortex/hub by smortex 3 years ago
- Ask for a token, not a password According to [this comment](1), 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 th... — committed to smortex/hub by smortex 3 years ago
- Ask for a token, not a password 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 ... — committed to smortex/hub by smortex 3 years ago
- Ask for a token, not a password 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 ... — committed to smortex/hub by smortex 3 years ago
- Ask for a token, not a password 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 ... — committed to smortex/hub by smortex 3 years ago
- Drop `hub` and just use GitHub CLI 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`, jus... — committed to bobwhitelock/dotfiles by bobwhitelock 2 years ago
- Switch from hub to gh 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: https://github.com/github... — committed to Smona/nixpkgs by Smona 2 years ago
- docs: Drop hub command from the RELEASE.md 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.... — committed to thriftrw/thriftrw-go by r-hang a year ago
- docs: Drop hub command from the RELEASE.md (#585) 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 ... — committed to thriftrw/thriftrw-go by r-hang a year ago
- Replace `hub` by `gh`. See https://github.com/mislav/hub/issues/2655#issuecomment-1793733289 — committed to nh2/nixos-configs by nh2 8 months ago
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
reposcope) 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.
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/hubfile like below (per mislav’s comment). Put in your username asuserand paste your PAT onoauth_token.Try
hub cloneThis didn’t fix it for me. Error stays the same. I will try to find a fix.
@mislav Can we change the intimation message until this is fixed? Something like
github.com token for <user>:rather thangithub.com password for <user>:? I think the message is fairly confusing.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 foundcould be replaced with:And when it says this:
It would be better to say:
You have NO idea how much I searched the internet to find this solution! THANK YOU!
They really not?
Use gh instead of hub, https://github.com/cli/cli
Thanks. This worked.
Somehow the password is not accepting the token I generated. Or is returning a 404.
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…
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.
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
@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!
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.
i created the repo with the below command and the push origin master worked: $ gh repo create
delete ~/.config/hub works to me!
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