Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
960 views
in Technique[技术] by (71.8m points)

git - 2FA give problems when pushing to GitHub

I've clone a project on GitHub on my Raspberry Pi, create a new branch and push everything to the repository. For this I needed next commands:

git clone https://www.github.com/heinpauwelyn/my_repo
git checkout -b raspberry
git push origin raspberry

The problem I've got is that I can't push the branch to GitHub.com. I need to enter my username and password, but I can't use 2FA for that. Is this a bug in Git or GitHub and is there a way to get an authentication key and enter it?

I'll not enable the 2FA on GitHub.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

with 2FA you have to create a personal access token to use as a password when authenticating to GitHub on the command line with HTTPS URLs: https://help.github.com/articles/which-remote-url-should-i-use/#when-2fa-is-enabled

or you can clone with ssh https://help.github.com/articles/which-remote-url-should-i-use/#cloning-with-ssh-urls (may also be useful: https://help.github.com/articles/generating-an-ssh-key/)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...