这很奇怪,但我不能将任何存储库(和新存储库)提交给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.
Run Code Online (Sandbox Code Playgroud)
嗨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
Run Code Online (Sandbox Code Playgroud)
但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/'
Run Code Online (Sandbox Code Playgroud)
如果重要的话,我会使用双因素身份验证.
问题出在这一行
git remote add origin https://github.com/demas/netrunner.git
Run Code Online (Sandbox Code Playgroud)
尝试通过http协议访问服务器时,git不使用您的ssh密钥(据我所知,在这种情况下使用Basic http auth).使用ssh访问(url看起来像git@github.com:username/reponame.git)
归档时间: |
|
查看次数: |
3102 次 |
最近记录: |