2017-04-20 62 views
-1

我只是尝试多个SSH身份在我的Mac,这是我设置如何使用本地SSH代理?

Host x 
HostName bitbucket.org 
IdentityFile ~/.ssh/id_rsa_x 

Host y 
HostName bitbucket.org 
IdentityFile ~/.ssh/id_rsa_y 

在主机Ÿ一切工作正常,但X没有工作,有人可以帮我解决这个

回答

1

主机名是一样的在两个条目上。 同时检查.ssh文件夹中IdentityFile的文件权限。

如果不能在所有的工作尝试调试SSH连接:

ssh -vvv [email protected] 
OpenSSH_5.1p1, OpenSSL 0.9.8a 11 Oct 2005 
debug1: Reading configuration data /etc/ssh/ssh_config 
debug1: Applying options for * 
debug2: ssh_connect: needpriv 0 
debug1: Connecting to host [x.x.x.x] port 22. 
debug1: Connection established. 
+0

嗨@mrks我遵循主机名本教程 [链接](https://confluence.atlassian.com/bitbucket/configure -multiple-ssh-identities-for-gitbash-mac-osx-linux-271943168.html) 它们具有相同的主机名 – alpiopio

+0

@alpiopio。在ssh的调试模式中,我看到ssh使用了配置文件中给出的正确的id文件。因此,请确保在远程目标上也部署了公钥。 – mrks

+0

感谢回复@mrks,这个问题刚刚发生在gitKraken上,它不会检测到我的别名,但是在源码树上都能正常工作 – alpiopio