git 出现错误 Could not resolve host: github.com
原来是因为github.com没有被主机给解析,
第一步 先 ping 看一下主机地址
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
然后 编辑文件etc/hosts
sudo vi /etc/hosts
# 按i进行修改
# 添加github地址
# 192.30.255.112 github.com
# 按ESC :wq 退出并保存