【发布时间】:2014-02-27 08:53:45
【问题描述】:
这很奇怪,但我无法将任何存储库(和新存储库)提交到 github。 我已将我的 ssh-key 上传到 github。
demas@demas-home:~/dotfiles$ ssh -T git@github.com
Warning: Permanently added the RSA host key for IP address '192.30.252.130' to the list of known hosts.
嗨,demas!您已成功通过身份验证,但 GitHub 不提供 shell 访问权限。
现在我创建一个新的存储库并尝试将第一个提交推送到 github:
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/demas/netrunner.git
git push -u origin master
但是 github 会询问我的用户名和密码。为什么?
即使我输入了我的用户名和密码,我也会收到错误:
demas@demas-home:~/netrunner$ git push -u origin master
Username for 'https://github.com': demas
Password for 'https://demas@github.com':
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/demas/netrunner.git/'
如果重要,我会使用双因素身份验证。
【问题讨论】:
-
您是否输入了您的 2fa 密码作为密码?查看help.github.com/articles/providing-your-2fa-security-code的底部
-
谢谢。它帮助到我。我需要输入个人访问令牌 (github.com/settings/applications) 作为密码。或者我可以使用 ssh url 代替 https