About two months ago I first switched to GitHub’s two-factor authentication. Later that day, when I went to push for the first, I had an authentication error and my push failed. I didn’t want to mess with the configuration that day, so I decided to turn off two-factor authentication on GitHub.
Another Go at Two-Factor Authentication on GitHub
After a new career move forced that I lock down my computer and my online identities like Fort Knox, I had no choice but to figure out how to get GitHub two-factor authentication working. Yet again, after I configured two-factor authentication on GitHub I had issues pulling from private repositories and pushing/pulling to any repository. So, after digging into the GitHub two-factor authentication blog post on GitHub, I came across this:
If you are using SSH for Git authentication, rest easy: you don’t need to do anything. If you are using HTTPS Git, instead of entering your password, enter a personal access token. These can be created by going to your application settings page.
The Solution is Simple
Pay particular attention to the first sentence: “If you are using SSH… you don’t need to do anything.” Well, up to this point, I hadn’t been using SSH for all of my GitHub repositories (although I had properly added my SSH key to GitHub). So, what I decided to do is switch my repositories to use SSH instead of HTTPS as I had issues with authenticating. Now, if you do a Google search for the title of this article, “Github Two-Factor Authentication Failed for HTTPS”, you’ll find that many people recommend going the HTTPS route and creating a personal access token. Pick your poison. Switching to SSH worked for me.
Questions or Comments?
If you have any questions or comments — specifically, if you know why someone would pick HTTPS over SSH — Please leave a comment below!