I'm trying to add 2 ssh keys in my pc to work with 2 gitlab accounts, I created 2 pair of keys and made this "config" file:
# Compte Perso
Host gitlab.com-perso
HostName gitlab.com
PreferredAuthentications publickey
IdentityFile C:\Users\<path>\.ssh\id_rsa_perso
# Compte Pro
Host gitlab.com
HostName gitlab.com
PreferredAuthentications publickey
IdentityFile C:\Users\<path>\.ssh\id_rsa
When I type ssh -T git@gitlab.com
and ssh -T git@gitlab.com-perso
, it works I have the output Wlecome to Gitlab, <username>!
, but when I try to clone like this git clone git@gitlab.com-perso:<username>/<reponame>.git
it says
Unable to open connection:
Host does not existfatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I know the repo can be cloned because I already cloned it in another pc with ssh but I don't understand why this doesn't work please help me. I have followed this to make my config file. (it's in french)