I have my personal GitHub account and I have GitLab account for work. I am using id_ed25519
for GitHub and it works perfectly. As I read in here and here, I should be able to create two different key and use for different accounts. Therefore, I created id_rsa
for GitLab and added to my GitLab account but all the time I am having below error.
Cloning into 'product'...
ssh: Could not resolve hostname gitlab.company.com: Name or service not known
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
My config file is located on ~/.ssh/config
and as shown as below
Host github
HostName github.com
IdentityFile ~/.ssh/id_ed25519
Host gitlab.company.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Also, you can see which files contain .ssh
folder
> ls -1
config
id_ed25519
id_ed25519.pub
id_rsa
id_rsa.pub
known_hosts
known_hosts.old
What I am doing wrong?