-
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
Authentication fails if two-factor auth is required #435
Comments
It might not be related to 2FA. In the output you pasted there is Can you give me more information about your system version and your shell? |
This is an OSX 10.9/Mavericks system. The shell is bash 4.2.45. Both the shell and hub were installed via MacPorts. |
I have the same issue with hub version 1.10.6 on OS X 10.9. Here's what I did:
|
Confirmed this is an issue with 2FA. I received the exact same response @dasevilla pasted above. I disabled 2FA temporarily, went back to try |
Disabling 2FA, authenticating hub, and enabling 2FA worked for me as well. |
I had the 401 issue with 1.10.6, because hub never asked for the 2FA code. Using the source from the current HEAD, installed using homebrew's For some reason, github never sent me any 2FA code by sms when hub requested it, as noted in the security history. Solved it by opening a private browser window, heading to github.com and performing the first step of logging in on the website. Instead of using the new sms auth token on the website, I used it for hub. Voilà, "oauth_access.create: hub (API)". |
Yeah, 2FA really seems kind of broken right now. I'll need to change the way hub authenticated completely to put an end to these and similar authentication woes. Right now, you can use GitHub's web interface to create a token manually that you can paste to ---
github.com:
- oauth_token: TOKEN
user: mislav |
@mislav where do you create the token? |
@mislav Couldn't the flow change to
? |
@afeld Detecting whether 2FA is enabled for your account is not the problem. However, I have other problems related to 2FA that I need to sort out. Expect an update soon |
Even a warning after a 401 like "See #435 if you have 2FA enabled" would be an improvement in the short term. Just so that people don't throw up their hands and walk away from it. |
This is very similar to how Composer (PHP dependency manager) handles GitHub 2FA. Here's the related discussion: composer/composer#2280 Still not resolved. |
hub initially tries to fetch user's existing OAuth token for hub if it exists, and will prompt the user for a 2FA code. However those who receive it via SMS would never get the code since a GET to GitHub's Authorizations API purposely doesn't trigger an SMS. There's some discussion as to whether this is an API bug for not, but in the meantime, make a dummy POST request for the sole reason of triggering the SMS. Fixes #412, closes #435, closes #445
@lawipac Composer has had 2FA support for many months now. However, this project is not Composer nor related to it at all. So, it's not an appropriate place to rant about your troubles with using Composer. If you need to report a bug to them, go to their issue tracker. |
In case Google search brings anyone else to this thread: I had this issue today with not being able to login via Git Shell until I disabled 2FA. A coworker suggested using a personal access token for specific apps to prevent this from happening in the future. https://help.github.com/articles/creating-an-access-token-for-command-line-use/ Does that sound about right? |
@rschuster3 Were you using hub or just plain git push/pull/clone? Where did you put the token? |
Just plain git push/pull/clone. I haven't made the token yet (since I was able to authenticate after I disabled 2FA) but it's on my to-do list for today. |
just did it myself. Create the token and enter it just as you would your password when signing in via Git Bash and you're good to go. |
All righty, I'll go ahead and set it up now. The shell is oddly asking me to authenticate again for a push I want to make. I say "oddly" because I'm not asked to authenticate normally. Will post here again if I have issues with the token. Thanks! |
might want to look into caching you credentials to help with that https://help.github.com/articles/caching-your-github-password-in-git/ |
The link provided by @rschuster3 works perfectly for my git kraken pulls issues after setting up 2 factor. |
I tried to use hub to create a pull request, but got an error:
This is most likely because I have github configured to require two-factor authentication. And indeed in the security history I see this:
The text was updated successfully, but these errors were encountered: