要求git寻找除id_rsa之外的其他密钥

Vir*_*ren 6 git ssh github

我不确定为什么,但即使我在ssh配置中正确提到为github查找名称为viren.pub的身份文件

混帐仍在考虑id_rsa为默认,它似乎并不除非工作,直到我重新命名viren.pub和viren到id_rsa.pub和id_rsa

这里我的ssh配置看起来像

Host ec2-123-121-121-121.compute-1.amazonaws.com
        Hostname github.com
        User git
        IdentityFile /root/.ssh/viren
Run Code Online (Sandbox Code Playgroud)

谁能帮忙

Jan*_*dec 5

我相信只有在使用host子句中定义的别名连接到服务器时,ssh配置才适用.

即你应该在ssh配置中有:

host github
    hostname github.com
    user git
    identityfile /root/.ssh/viren
Run Code Online (Sandbox Code Playgroud)

该host指令必须遵循您实际用于连接的内容,因此[Amazon server]不合适.你必须告诉git连接到:

github:/....
Run Code Online (Sandbox Code Playgroud)

(而不是git@github.com:/.....)