If you are on windows, cloning with https may be a better option for you. You don’t have to set up ssh agent (which sounds alien for most windows user). You also don’t have to enter password every time you use, you can cache your password by following github’s article. In short, make sure you have msysgit 1.8.1 and above and set credential helper as follows:

git config --global credential.helper wincred

Two factors authentication

But after you enable 2FA, the above method doesn’t work anymore. We need a few more steps to make https url work with 2FA.

  1. Go to Github application settings github application settings
  2. Click Generate new token
  3. Note down your token.
  4. Go to Windows Credentials Manager Windows credentials manager
  5. Click Add a generic credential
  6. Enter your credential with the generated token. Note that address format is git:https://<username>@github.com Add credential

That’s all, you should now be able to push without entering any username and password.