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

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

  • 一、错误原因
  • 二、解决方法
    • 1、解析出域名对应的IP地址
    • 2、把域名和IP地址添加到主机的hosts配置文件中

一、错误原因

git clone 从github上克隆项目的时候出现这个错误,下面我贴出详细的错误信息

mosheng@ms-server:11_DSPR$ git clone https://github.com/cszn/DPSR.git
Cloning into 'DPSR'...
fatal: unable to access 'https://github.com/cszn/DPSR.git/': Could not resolve host: github.com

这个错误的原因可能是github.com 域名没有被主机解析,下面给出具体的解决方法:

二、解决方法

1、解析出域名对应的IP地址

命令:ping 域名地址

mosheng@ms-server:11_DSPR$ ping github.com
PING github.com (13.229.188.59) 56(84) bytes of data.

从上面可以看到,解析出的github的域名的IP地址为:13.229.188.59

2、把域名和IP地址添加到主机的hosts配置文件中

host配置文件的地址:/etc/host

vi /etc/hosts
git clone 出现错误 Could not resolve host: github.com_第1张图片
然后把13.229.188.59 github.com 添加到对应的下方,之后保存退出即可

最后在克隆一下试试吧,应该是惊喜把!!!

在这里插入图片描述



在这里插入图片描述
♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠

你可能感兴趣的:(16_各种错误和bug(你的痛,我的痛,痛痛痛))