现象:
ylj@ylj-VirtualBox:~/workspace$ eval "$(ssh-agent -s)"
Agent pid 19124
ylj@ylj-VirtualBox:~/workspace$ ssh-add
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0777 for '/home/ylj/.ssh/id_rsa' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
原因:
ssh key 权限不够
方法:
chmod 600 ~/.ssh/id_rsa
千万不要用:
chmod 777 ~/.ssh/id_rsa
为什么777不行,具体是什么原因还不是很明白。如果谁知道可以留言给我
现象二
Cloning into 'nex2'...
Agent admitted failure to sign using the key.
原因:
公钥没有加入 ~/.ssh/authorized_keys 当中
解决办法:
<pre name="code" class="html">#eval "$(ssh-agent -s)"
#ssh-add ~/.ssh/id_rsa
注意 ssh-add 后面的路径需要根据自己设定的路径进行改变