-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Error creating pull request: Unauthorized (HTTP 401) #491
Comments
I'm running the latest tagged version 1.11.2. I also can't find a |
@pwaller I'm sorry you had troubles authenticating. Let's start from the beginning: what is the outcome that you get when hub asks you for your GH credentials? It should ask you for username, password (your actual GH password; never stored), and 2FA code if you have that enabled. Does it ask you for all three, and fails after that? Is the error message that you pasted the full error output? After you entered your actual GH credentials + 2FA code, even if the Ultimately, if you're still blocked on this, here is how you can provide auth info to hub manually:
|
Hi @mislav, When I wrote this post I got it working by making I've just realised that I have |
Right now, hub is designed in a way that it doesn't want you to manually create an access token and pass it to it. It wants to exchange your real credentials for an OAuth token so you don't have to go through manual steps. In the future, we might add extra authentication features for pasting a Personal access token. |
The problem is that from the command line it isn't obvious what hub needs you to do if you have 2FA enabled, if I'm understanding correctly. That lead to a broken experience, and caused me to not use hub for several months after using it for years. |
From what I understood, the problem was that when hub asked you for your actual GitHub password, you provided the Personal access token (which is not a stand-in for a password always), either by pasting it or via $GITHUB_PASSWORD. Is that correct? if so, it doesn't sound like hub was broken. It just sounds you were doing auth the wrong way. How would you like me to solve this issue? Detect whether you tried to use a Personal access token in the wrong place, and warn you about it? |
Hm. I guess the actual problem in my case is that other utilities work with I think at some point I figured out to unset |
OK, so the actual problem of hub is that it's not user-friendly enough when it comes to auth issues. Yeah, other utilities can work with a password being an OAuth token if they use Basic Authentication for the API. We don't, however. I just realized we had this discussion in #463. We should improve the situation around this. Follow that ticket for updates. |
👍 |
Authentication options are discussed in mislav#491 and mislav#463; it would be good to have some of this information in the README as well.
This led me astray. Should be:
Hopefully this helps someone, five years later! 😂 |
How do I create the Personal Access Token? |
With apologies to @mislav, I'm reviving #83, #413, #412, #435.
I'm reviving it because this has broken my (and others in my org) ability to use hub at all for months and I wasn't aware of the workarounds available in the above linked issues. I had assumed something had broken in my environment.
It broke for me because as a security precaution I clobbered all of my existing OAUTH tokens, which were originally generated by signing in at the command line. I expected the previous process (enter credentials at the command line) to work, but it doesn't any more, with no explanation as to why.
I did try to generate a "personal access token" and enter it when hub prompted me for a password but of course that didn't work. I expected it to work because of the description "They can be used instead of a password for Git over HTTPS, or can be used to authenticate to the API over Basic Authentication". But it doesn't.
The current experience is:
hub pull-request
, enter credentials, enter message, wait a few seconds, etc.Please close this issue once it is fully resolved such that the user experience at the command line is not broken, otherwise it's hard to teach newbies to use hub. One has to know that having 2FA enabled means you have to generate a token and edit a config file which is not at all apparent from the UI.
The text was updated successfully, but these errors were encountered: