8

I'm trying to push code in my local repo (on an OS X 10.8.5 system with the GitHub app installed and logged into) to a repo I created on GitHub via their website, using the command line. Oddly, when I try to git push -u origin master, I log in with my (correct) GitHub credentials, and get fatal: Authentication failed.

I do use dual-factor authentication, but I've authenticated the machine with this issue through the GitHub application. I've also got the appropriate SSH key for this operation.

What's the cause of this issue? How can it be fixed?

1 Answer 1

14

Two-factor auth generally doesn't work per machine – it works per client. When you log in to GitHub using a web browser, it's the web browser that remembers cookies with both the auth info, and the 2FA status. git does not know about that.

To push over HTTP(S), you will need to generate a secondary password ("personal access token") in GitHub's application settings page (use the "Create new token" button). Note that git can remember the "password" if you don't want to retype/paste it every time.

1
  • GitHub support has actually gotten back to me with the same solution, which works perfectly. Thanks!
    – Jules
    Sep 20, 2013 at 13:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .