2FA推送到GitHub时出现问题

2FA推送到GitHub时出现问题

问题描述:

我已经在Raspberry Pi的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

我遇到的问题是我无法将分支推送到GitHub.com.我需要输入用户名和密码,但是不能使用2FA.这是Git还是GitHub中的错误,有没有办法获取身份验证密钥并输入它?

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?

我不会在GitHub上启用2FA.

I'll not enable the 2FA on GitHub.

,您必须创建个人访问令牌,以在使用HTTPS URL的命令行上向GitHub进行身份验证时将其用作密码:

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

或者您可以使用ssh克隆 https://help.github.com/articles/generating-an-ssh-key/)

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/)