git clone(权限被拒绝)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7906961/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
git clone (Permission Denied)
提问by Headshota
Hi I'm trying to clone my project from github repo. I've added Public Key, tested ssh with ssh -T [email protected]
successfully. but when I try to clone one of my projects I get the following message:
嗨,我正在尝试从 github 存储库克隆我的项目。我添加了公钥,并ssh -T [email protected]
成功测试了 ssh 。但是当我尝试克隆我的一个项目时,我收到以下消息:
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
权限被拒绝(公钥)。
致命:远端意外挂断
回答by hvgotcodes
It could be many things. There are explicit instructions how how to debug this issue at
它可以是很多东西。有明确的说明如何调试这个问题
http://help.github.com/ssh-issues/
http://help.github.com/ssh-issues/
You are basically going to have to try to ssh to github with verbose logging, and it should tell you what the issue is. Probably a permissions issue on your public key file....
您基本上将不得不尝试使用详细日志记录 ssh 到 github,它应该会告诉您问题是什么。可能是您的公钥文件的权限问题....
回答by AbhinavChoudhury
The ssh key registered with your Github account probably does not match the one currently in use on your system, or was probably changed after registering with Github.
使用您的 Github 帐户注册的 ssh 密钥可能与您系统上当前使用的密钥不匹配,或者可能在向 Github 注册后被更改。
Try this:
尝试这个:
cat ~/.ssh/id_rsa.pub
Copy the output of the last command
Go to account settings on Github and add a new SSH key
cat ~/.ssh/id_rsa.pub
复制最后一条命令的输出
转到 Github 上的帐户设置并添加新的 SSH 密钥
Then try the clone command.
然后尝试克隆命令。
回答by Joarder Kamal
First, follow the instructions provided by AbhinavChoudhury
首先,按照 AbhinavChoudhury 提供的说明进行操作
$ cat ~/.ssh/id_rsa.pub
$ cat ~/.ssh/id_rsa.pub
Copy the output of the last command
复制最后一条命令的输出
Go to account settings on Github and add a new SSH key
转到 Github 上的帐户设置并添加新的 SSH 密钥
Then use the below command to test the connection:
然后使用以下命令测试连接:
$ ssh -vT [email protected]
$ ssh -vT [email protected]
回答by Sanova
Most likely (besides and incorrect keyfile) you have to set the permissions on your .pem file (i think its to 644) and then use sudo on the git clone command. That's what worked for me.
很可能(除了和不正确的密钥文件)您必须设置 .pem 文件的权限(我认为它是 644),然后在 git clone 命令上使用 sudo 。这就是对我有用的东西。