要求git去查找除id_rsa以外的其他键 [英] Asking git to look for different key other than id_rsa

查看:147
本文介绍了要求git去查找除id_rsa以外的其他键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道为什么,但即使我在ssh config中正确地提到为github寻找名称为viren.pub的身份文件



git仍将id_rsa视为默认值,除非直到我将 viren.pub viren 重命名为 id_rsa.pub id_rsa ,否则似乎不起作用。



这里我的ssh配置看起来像

 主机ec2-123- 121-121-121.compute-1.amazonaws.com 
主机名github.com
用户git
IdentityFile /root/.ssh/viren

p>

任何人都可以帮忙解决方案

我相信ssh config仅适用于使用 host 子句中定义的别名连接到服务器的情况。

你应该在ssh config中有:

  host github 
hostname github.com
user git
identityfile /root/.ssh/viren

主机指令必须跟着你实际用来连接的东西,所以 [Amazon服务器] 是不合适的。你必须告诉git连接到:

  github:/ .... 
git@github.com:/ .....

/ p>

I not sure why but even though I mention properly in ssh config to look for identity file with name viren.pub for github

git still considering id_rsa as default and it does not seem to work unless an until i rename viren.pub and viren to id_rsa.pub and id_rsa

Here my ssh config look like

Host ec2-123-121-121-121.compute-1.amazonaws.com
        Hostname github.com
        User git
        IdentityFile /root/.ssh/viren

Can anyone help

解决方案

I believe the ssh config only applies if you use the alias defined in host clause to connect to the server.

I.e. you should have in ssh config have:

host github
    hostname github.com
    user git
    identityfile /root/.ssh/viren

The host directive has to be followed with something you will actually use to connect, so [Amazon server] is not appropriate. And you have to tell git to connect to:

github:/....

(and not git@github.com:/.....)

这篇关于要求git去查找除id_rsa以外的其他键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆