GIT Troubleshooting

> git clone doesn't work after enable 2FA (two factor authentification)

How does it work for command-line Git?

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 personal access tokens page.

In case if you want to switch from HTTPS to SSH you just need

  • to replace the url in the .git/config
  • add your public ssh key to github account

If you faced with issue "Key is already in use" during the adding of the ssh key
Run the bellow command to find the account where key is already in use.
ssh -T -ai ~/.ssh/id_rsa git@github.com
# Connect to GitHub using a specific ssh key
Hi username! You've successfully authenticated, but GitHub does not
provide shell access.

To resolve the issue, first remove the key from the other account or repository and then add it to your account If you don't have permissions to transfer the key, and can't contact a user who does, remove the keypair and generate a brand new one