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]

 



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 try ssh-add command to add the keys. "ssh -T git@xxxxxxxxxx" can work, but git clone/push/pull these action display "Permission denied (publickey)".
Test in git version 2.38.1.windows.1 with win10 and git version 2.34.1 with Ubuntu 22.04.1 LTS
I check the -v and -vvv log, git does read my config file in ~/.ssh.

After I change the repo address to host("github") in my ssh config file, i can clone the repo and push/pull.
Host github
  HostName github.com
  PreferredAuthentications publickey
  IdentityFile ~/.ssh/id_rsa_111
So I change the host to "github.com" in ssh config, everything is back to normal.
Host github.com
  HostName github.com
  PreferredAuthentications publickey
  IdentityFile ~/.ssh/id_rsa_111

 I think when git read ssh config, it uses host to match the key instead of hostname. Is this bug?



[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