“fatal: Authentication Failed” Error When Running Git Push From VSCode To Github with 2FA Enabled

While working on some custom guest policy in VSCode today (posts coming on that soon!) I came across an issue that I hadn’t encountered previously. While attempting to push my code to my Github repository, I encountered a “fatal: Authentication failed for <repo URL>” error. Of course I tried to retype my username and password multiple times, and even reset my password on Github, but to no avail. After a bit of research, I came across an article that saved me quite a bit of time in troubleshooting. In short, I had recently enabled 2FA on my Github account, which was causing my authentication via username and password to fail (which makes sense). The workaround for this issue is actually quite simple, and involves creating an access token in your Github settings and using that token as your password when prompted during a push from VSCode.

In the name of not reinventing the wheel and taking credit for others work, this article outlines the process step by step.

Hopefully this saves other some troubleshooting time, and remember to store your token somewhere secure!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s