ssh -T 无法连接GitHub,Could not resolve hostname github.com

背景

$ ssh -T git@github.com
ssh: Could not resolve hostname github.com: No address associated with hostname

解决方法:

1、首先获取 github.com IP 地址

IP 地址查询:Click

通过上述网站查询得到 github.com IP 地址如下

140.82.113.4

2、接着修改本地 DNS 文件,在hosts文件中添加

140.82.113.4 github.com

Win hosts文件:C:\Windows\System32\drivers\etc\hosts

Linux hosts文件:/etc/hosts

3、再次查看是否连通

$ ssh -T git@github.com
Hi zkx! You've successfully authenticated, but GitHub does not provide shell access.
posted @ 2022-07-25 11:14  zkx98  阅读(750)  评论(0编辑  收藏  举报