Re: When using several ssh key, Git match ssh key by host, instead of hostname in ssh config file.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Yangyang Hua <hyy_41@xxxxxxxx> writes:

> Hi, I find when I use several ssh keys with the right config file
> and clone my private repo, git can't match the key by hostname.
> ...
> I think when git read ssh config, it uses host to match the key
> instead of hostname. Is this bug?

This useful feature is given by ssh, and Git does not deserve credit
for it.  The config file of SSH allows you to write multiple entries
that points at the same host, e.g.

    Host host1
      HostName host.example.com
      IdentityFile ~/.ssh/id_rsa_111

    Host host2
      HostName host.example.com
      IdentityFile ~/.ssh/id_rsa_222

so that you can specify which key to use for the same destination
when you have more than one user there. "ssh host1" uses id_rsa_111
while "ssh host2" uses the other one, both connections going to the
same destination host.

If host.example.com were a hosting site like github.com, you can use this
feature to say

    $ git push git@host1:/me/lesson1

to connect using id_rsa_111.  If you use

    $ git clone git@xxxxxxxxxx:/me/lesson1

there is no clue which of the two entries you want to use.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux