Issue
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 [email protected]
and ssh -T [email protected]
, it works I have the output Wlecome to Gitlab, <username>!
, but when I try to clone like this git clone [email protected]:<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)
Solution
Quick google search search for your error message reveals that this problem may be related to "Little Snitch" software - if you use it disable and try again.
Also, on Windows machines you may need to modify windows system environment variables
GIT_SSH=C:\Program Files\Git\usr\bin\ssh.exe
as you can see in this StackOverflow thread
If none of this works, there are couple of other ideas out there. It's a good idea to try at least couple of them and collect some more verbose output so we can help you better if still needed.
Answered By - Lukasz Korbasiewicz Answer Checked By - Candace Johnson (WPSolving Volunteer)