git 出现错误 Could not resolve host: github.com

也不知道为什么在使用git下载东西的时候出现了错误,,然后重新安装了电脑发现还是不起作用没办法只有谷歌


最后结合几家的意见找到了解决办法


原来是因为github.com没有被主机给解析,


第一步 ping github.com
PING github.com (192.30.255.112): 56 data bytes
64 bytes from 192.30.255.112: icmp_seq=0 ttl=43 time=144.449 ms
64 bytes from 192.30.255.112: icmp_seq=1 ttl=43 time=140.965 ms
^C
--- github.com ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 140.965/142.707/144.449/1.742 ms


先 ping 看一下主机地址


然后 编辑文件etc/hosts


sudo vi /etc/hosts


i  启动编辑模式

::1             localhost
192.30.255.112  github.com

然后添加github的地址


esc 退出编辑模式


:wq退出vi


评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值