Git push not working after enabling two factor authentication


I recently enabled two factor authentication to protect my github account. After I enabled it, I was not able to push changes to github repository using git push command. I still use username and password authentication when prompted by git push command.

You will need to Create a PAT and use it instead of your password when performing Git operations over HTTPS. The token will need the repo and workflow scopes if you want to be able to push to all your repositories including Actions workflows.

Then when prompted for your password for Git operations, enter the PAT instead of your password. Note that you will still need your password (plus the second factor) to log in to the website.