不为成仙,只为在这红尘中等你回来。

您现在的位置是:网站首页>>Linux

Could not resolve host: github.com

2018年5月29日 10:21 | 分类:Linux | 标签: Linux Git

向 github git push 时出现下面错误:

$ git push origin master
fatal: unable to access 'https://github.com/fangweiren/LeetCode-Python.git/': Could not resolve host: github.com

解决

原因:github.com 没有被主机解析

1.终端输入命令 ping github.com,获取到 github.com 的 ip

$ ping github.com
ping: unknown host github.com

ping: unknown host 解决办法

$ ping github.com
PING github.com (192.30.255.112) 56(84) bytes of data.
64 bytes from github.com (192.30.255.112): icmp_seq=1 ttl=128 time=215 ms
64 bytes from github.com (192.30.255.112): icmp_seq=2 ttl=128 time=223 ms
64 bytes from github.com (192.30.255.112): icmp_seq=3 ttl=128 time=215 ms
^C
--- github.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 215.462/218.109/223.248/3.654 ms

2.直接修改 /etc/hosts 文件,在底部添加:
192.30.253.112 github.com

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