Use password instead of token with 2FA enabled on github

I recently activated 2FA on github and now all my local repositories in all my computers stopped working (I use them over https). It seems that I have to either switch to SSH or create a Personal access token.

The way my git settings are configured is that never ask for the username but always ask for password when doing pull/push, and I don't want to change that but I also don't want to write my personal access token everytime I do git push/pull.

The ideal thing will be asking for my 2FA code just once and then only asking me for my password (something like remembering my computer). Am I doing something wrong?


I don't think there is a solution like the one you are searching. I think your best choice would be to generate an ssh key and add it to Github. It is a very easy process, just follow this link: https://help.github.com/enterprise/2.9/user/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/

If you don't want to change all your repo urls to ssh, you could run: git config --global url."git@github.com:".insteadof https://github.com/ This instructs git to pull and push to the ssh url rather than https.

链接地址: http://www.djcxy.com/p/22076.html

上一篇: 2时,通过HTTPS检出私人github存储库

下一篇: 在github上启用2FA时使用密码而不是标记