本文介绍了GitHub:权限被拒绝(publickey)。致命的:远端意外挂断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我按照以下说明上传项目。
I have followed these instructions below to upload a project.
全局设置:
Download and install Git
git config --global user.name "Your Name"
git config --global user.email tirenga@gmail.com
Add your public key
Next steps:
mkdir tirengarfio
cd tirengarfio
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin git@github.com:tirenga/tirenga.git
git push origin master
但是我得到这个错误:
But I get this error:
推荐答案
对我来说问题是通过sudo执行clone。
For me the problem was the execution of clone via sudo.
如果你克隆到一个拥有用户权限的目录(/ home / user / git),它将正常工作。
If you clone to a directory where you have user permission ( /home/user/git) it will work fine.
(说明:以超级用户身份运行一个命令不会像使用用户一样运行相同的公共密钥,因此Github拒绝连接。)
(Explanation: Running a command as superuser will not work with the same public key as running a command as user. Therefore Github refused the connection.)
此解决方案需要设置SSH密钥:
This solution requires a SSH key already to be set up: https://help.github.com/articles/generating-ssh-keys
这篇关于GitHub:权限被拒绝(publickey)。致命的:远端意外挂断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!