美文网首页
git 出现错误 Could not resolve host:

git 出现错误 Could not resolve host:

作者: sunny冲哥 | 来源:发表于2017-07-12 09:08 被阅读2586次

今天早上push项目到远程仓库的时候,突然出现这个错误:

Could not resolve host: github.com

经查询,原来是github.com没有被主机解析
可通过以下方法解决

  1. 打开终端,输入以下命令
ping github.com

结果如下图


github ip地址
  1. 退出ping命令,编辑文件etc/hosts,执行命令
sudo vi /etc/hosts

i 启动编辑模式,然后添加github的地址

# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
192.30.255.112  github.com  //github地址
::1             localhost
fe80::1%lo0     localhost

esc
:wq 退出即可

相关文章

网友评论

      本文标题:git 出现错误 Could not resolve host:

      本文链接:https://www.haomeiwen.com/subject/ejivhxtx.html