我有我的个人GitHub账户,我有工作用的GitLab账户.我正在使用GitHub的id_ed25519
,它工作得很好.正如我在here和here中所读到的,我应该能够创建两个不同的密钥并用于不同的帐户.因此,我为GitLab创建了id_rsa
,并添加到我的GitLab帐户中,但我一直都有以下错误.
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.
我的配置文件位于~/.ssh/config
上,如下所示
Host github
HostName github.com
IdentityFile ~/.ssh/id_ed25519
Host gitlab.company.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
此外,您还可以查看哪些文件包含.ssh
个文件夹
> ls -1
config
id_ed25519
id_ed25519.pub
id_rsa
id_rsa.pub
known_hosts
known_hosts.old
我做错了什么?