Can't push to my own repo after enabling 2FA #190276
-
|
I enabled 2FA on my GitHub account yesterday, and now I can't push to my repositories. I keep getting: remote: Invalid username or password. What am I doing wrong? Do I need to change something after enabling 2FA? Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
This comment was marked as off-topic.
This comment was marked as off-topic.
-
|
If you enabled 2FA, you can no longer use your GitHub password for pushing code. Instead, you need to use a Personal Access Token (PAT). Steps:
Alternatively, you can switch to SSH authentication for a more secure setup. |
Beta Was this translation helpful? Give feedback.
-
|
One thing that often causes confusion after enabling 2FA is that Git operations over HTTPS stop accepting your GitHub account password, but Git may continue trying to use cached credentials without making it obvious. If anyone still encounters this after creating a Personal Access Token (PAT), it can help to:
A more descriptive error message from GitHub would definitely improve the experience. "Authentication failed" doesn't clearly indicate that the account password is no longer valid for Git operations after enabling 2FA. |
Beta Was this translation helpful? Give feedback.
If you enabled 2FA, you can no longer use your GitHub password for pushing code.
Instead, you need to use a Personal Access Token (PAT).
Steps:
Alternatively, you can switch to SSH authentication for a more secure setup.