SSH自动login为一个用户,但不是其他

我想为我的git用户启用使用.ssh / config文件的自动sshlogin。

这是我的.ssh / config文件:

Host test HostName myserver.net User test IdentityFile ~/.ssh/id_rsa Host git HostName myserver.net User git IdentityFile ~/.ssh/id_rsa 

它适用于我的testing用户,但不适合我的git用户,所以我的全局SSHconfiguration是正确的。

就我所知,configuration完全相同。 它曾经与git用户一起工作,但我无法改变已经打破了自动login。

当我input:

 ssh -v git 

我得到以下日志:

 ... debug1: Authentications that can continue: publickey,password debug1: Next authentication method: publickey Offering RSA public key: /Users/mylocalusername/.ssh/id_rsa debug1: Authentications that can continue: publickey,password debug1: Next authentication method: password [email protected]'s password: _ 

有谁知道什么可能是一个可能的差异

检查服务器上的日志,看看为什么它不接受用户的密钥。 您可能需要将sshd_config的日志级别更改为

 LogLevel DEBUG 

并重新启动sshd