Git authentication fails after enabling 2FA


I just enabled 2FA (I can’t think of any other changes I made) and git asked for my username and password. I provided both, but they were “wrong”. I tried many of the solutions here: Git push requires username and password but that didn’t work. In particular, when switching from https to ssh, the ssh key gives

Permission denied (publickey).
fatal: Could not read from remote repository.

Any tips?


You need to generate an access token. You can create one by going to your settings page.

enter image description here

Use this access token as your password in the command line.

Leave a Reply