我遇到这个问题已经有一段时间了。基本上,我无法使用带有 https 的 GitBash 从我的工作计算机推送到 GitHub 上的个人存储库。
这是错误信息
$ git push origin master
Username for 'https://github.com':
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/georgeliu1998/mlnd.git/'
Run Code Online (Sandbox Code Playgroud)
检查了以下这些线程,但它们似乎不是相同的情况。
事实证明,我需要使用我的用户名登录,但我应该使用可以在此处创建的个人访问令牌,而不是使用普通的 GitHub 帐户密码。
因为我使用了名为“双因素身份验证”的 GitHub 功能(它不是标准的 Git 功能,它是 GitHub.com 添加的功能)。打开该功能后,我必须创建“个人访问令牌”
参考
https://help.github.com/articles/about-two-factor-authentication/
https://github.com/settings/tokens