我跟着 SSH Git without having to type in my password every time
但现在我仍然需要每次都输入密码。
[root@web2 .ssh]# pwd
/home/git/.ssh
[root@web2 .ssh]# /etc/init.d/sshd restart
Stopping sshd: [ OK ]
Starting sshd: [ OK ]
------------
caojinhuamatoMacBook-Pro:.ssh caojinhua$ ssh -p 2332 git@xx.xx.xx.xxx
The authenticity of host '[xx.xx.xx.xxx]:2332 ([xx.xx.xx.xxx]:2332)' can't be established.
RSA key fingerprint is 9b:e6:97:b1:a7:22:bd:b3:20:57:f3:0b:01:4e:b7:eb.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[xx.xx.xx.xxx]:2332' (RSA) to the list of known hosts.
git@xx.xx.xx.xxx's password:
Last login: Mon Jun 27 11:00:16 2011 from 121.x8.23x.1x3
[git@web2 ~]$
答案 0 :(得分:1)
您应确保~/.ssh/authorized_keys
的权限为600。
答案 1 :(得分:0)
您没有正确添加密钥,密钥格式错误,您有权限问题,或者主机上的SSH配置只允许密码验证。
在四种可能性中,第二种可能性最大。例如,如果将SSH.com格式的密钥剪切并粘贴到authorized_keys中,则无法正常工作。您必须先将其转换为OpenSSH格式。
您的公钥在authorized_keys中是什么样的? (发布它没有坏处 - 毕竟它是公钥)