GIt连接被远程主机关闭

时间:2018-07-31 03:24:06

标签: git ssh rsa

我只是在git上配置了两个ssh键,但是当我测试ssh连接时,它返回错误,这是

调试日志:

debug1: key_load_public: No such file or directory

Connection to code.aliyun.com closed by remote host.
Connection to code.aliyun.com closed.
Transferred: sent 2528, received 1472 bytes, in 0.0 seconds
Bytes per second: sent 12863830.2, received 7490331.5
debug1: Exit status -1

我不知道哪里出了问题,我已经将公钥发送到服务器了,仍然出错,谢谢

1 个答案:

答案 0 :(得分:1)

配置了这两个密钥后,这取决于您使用的现有SSH URL。

应该配置多个SSH密钥in a ~/.ssh/config file

Host key1
 HostName code.aliyun.com
 IdentityFile ~/.ssh/my_key1
 User git
Host key2
 HostName code.aliyun.com
 IdentityFile ~/.ssh/my_key2
 User git

URL将是:

key1:aUSer/aRepo