mac配置多个sshkey遇到的问题

问题一

ssh: Could not resolve hostname github: nodename nor servname provided, or not known
fatal: Could not read from remote repository.

问题二

ssh: connect to host github port 22: Connection refused

解决方法
cd ~/.ssh/
ls查看是否有config文件
如果没有touch一个config文件

重点来了「将id_rsa_github替换成你自己的,直接复制」

#这个是配置gitee
Host gitlab.com
User gitlab
HostName gitlab.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_ gitlab
Port 443

#这个是配置的github
Host github.com
User git
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_github 
Port 443

测试是否成功链接

way1: ssh -T [email protected] (域名)
way2:  ssh -v [email protected] (域名)「这个跑到仔细」

网上的配置etc/host对于我配置多个sshkey遇到这个问题每个卵用

你可能感兴趣的:(mac配置多个sshkey遇到的问题)