“git clone”命令拒绝SSH公钥
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1823642/
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
SSH Public key denied on "git clone" command
提问by KT.
I am trying to clone a git repo that I forked in my GitHub Repository.It's a rails app. I want to clone it on my local git so that I can push it onto heroku. I generated a set of rsa keys and copied it onto my GitHUb public keys. When I try to git clone "public url"
, It says public key denied. I tried an ssh [email protected]
to verify my key, it also says public key denied. I've tried several different things to make it work but it still hasn't. I tried to change permissions to 600 and 700 on my .ssh folder. I also tried adding a dsa key because the rsa won't work. please help me. Thanks. :)
我正在尝试克隆我在 GitHub 存储库中分叉的 git 存储库。这是一个 rails 应用程序。我想在我的本地 git 上克隆它,以便我可以将它推送到 heroku。我生成了一组 rsa 密钥并将其复制到我的 GitHUb 公钥上。当我尝试时git clone "public url"
,它说公钥被拒绝。我试图ssh [email protected]
验证我的密钥,它也说公钥被拒绝。我尝试了几种不同的方法来使其工作,但仍然没有。我尝试将 .ssh 文件夹的权限更改为 600 和 700。我还尝试添加 dsa 密钥,因为 rsa 不起作用。请帮我。谢谢。:)
I'm on Vista btw.
顺便说一句,我在 Vista 上。
回答by Scott
Answering a very old thread, here, but I'm on Cygwin and just had to do this to start work with my newly created site on phpfog.com
在这里回答一个非常旧的线程,但我在 Cygwin 上,只需这样做才能开始使用我在phpfog.com上新创建的站点
First, I ran this in cygwin:
首先,我在 cygwin 中运行了这个:
exec ssh-agent bash
ssh-add ~/.ssh/private-key-name
I then received:
然后我收到:
Identity added: /home/scott/.ssh/private-key-name (/home/scott/.ssh/private-key-name)
回答by Srinivas Kattimani
Copy the public key on your computer i.e., ~/.ssh/id_rsa.pub
(open it with notepad)
复制你电脑上的公钥即,~/.ssh/id_rsa.pub
(用记事本打开)
Paste this key in the "Add SSH key" section in your github account.
将此密钥粘贴到您的 github 帐户中的“添加 SSH 密钥”部分。
Note: to generate a ssh key if doesnt already exist, use ssh-keygen -t rsa
注意:要生成 ssh 密钥(如果尚不存在),请使用 ssh-keygen -t rsa
回答by Alan Haggai Alavi
Can you try adding the private key using ssh-add
?
您可以尝试使用添加私钥ssh-add
吗?
回答by KT.
After a lot of googling, I found this answer. I had to start the bash engine before i can add the keys. I cloned my app from github to my local server as well.
经过大量的谷歌搜索,我找到了这个答案。在添加密钥之前,我必须启动 bash 引擎。我也将我的应用程序从 github 克隆到了本地服务器。
回答by Jakub Nar?bski
回答by gayavat
Consider using ForwardAgent option.
考虑使用 ForwardAgent 选项。
Try add:
尝试添加:
Host *
ForwardAgent yes
to /etc/ssh/ssh_config on local machine.
到本地机器上的 /etc/ssh/ssh_config。
回答by Max Ivak
I had the same problem. Check the contents of your public key file:
我有同样的问题。检查您的公钥文件的内容:
- it must start with ssh-rsa
- it must be ONE line
- the format is like this: ssh-rsa manysymbolshere== somekeyname
- 它必须以 ssh-rsa 开头
- 它必须是一行
- 格式是这样的:ssh-rsa manysymbolshere== somekeyname
if you generated the key using puttygen in Windows - DO NOT save public key to a file on disk - it will have comments, which you must delete before copying to a server. Copy the public key to clipboard and then save to a *.pub file using notepad.
如果您在 Windows 中使用 puttygen 生成密钥 - 不要将公钥保存到磁盘上的文件 - 它会有注释,您必须在复制到服务器之前将其删除。将公钥复制到剪贴板,然后使用记事本保存到 *.pub 文件。
回答by Ian
SSL certificate rejected trying to access GitHub over HTTPS behind firewalllooks to be a very similar question. One solution I took from from those answersto quickly clone a git repository when I don't have the keys set up is to:
SSL证书被拒绝尝试通过防火墙后面的HTTPS访问GitHub看起来是一个非常相似的问题。当我没有设置密钥时,我从这些答案中获取的一种快速克隆 git 存储库的解决方案是:
export GIT_SSL_NO_VERIFY=true
then clone away.
然后克隆。