hub: Authentication fails if two-factor auth is required

I tried to use hub to create a pull request, but got an error:

$ hub pull-request -i 350
github.com username: wichert
github.com password for wichert (never stored): stty: standard input: unable to perform all requested operations

Error creating pull request: Unauthorized (HTTP 401)

This is most likely because I have github configured to require two-factor authentication. And indeed in the security history I see this:

image

About this issue

  • Original URL
  • State: closed
  • Created 11 years ago
  • Comments: 21 (5 by maintainers)

Commits related to this issue

Most upvoted comments

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.

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?

might want to look into caching you credentials to help with that

https://help.github.com/articles/caching-your-github-password-in-git/

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 ~/.config/hub:

---
github.com:
- oauth_token: TOKEN
  user: mislav