github无法访问克隆不了项目下载失败没反映的解决方法

当我们克隆github上的项目时,有时因为DNS的问题,基本上克隆不了,一直卡在Clone into 'go'...,如下图所示:

jagitch@34c4dd4d4a3e:opensource$ git clone https://github.com/golang/go.git
Cloning into 'go'...

解决方法:

  1. 查询github.com的ip地址,如下图所示,github.com的ip为对20.205.243.166

    github无法访问克隆不了项目下载失败没反映的解决方法_第1张图片

  2. 将上一步查询到的github.com的IP配置到/etc/hosts文件中,如果是Windows系统,则修改C:\Windows\System32\drivers\etc\hosts文件

    127.0.0.1       localhost
    ::1     localhost ip6-localhost ip6-loopback
    fe00::0 ip6-localnet
    ff00::0 ip6-mcastprefix
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrout

你可能感兴趣的:(开发环境搭建,github)