在 CentOS 服务器
上经过 git clone
下载项目,速度很慢或直接超时git
[root@VM-0-11-centos home]# git clone https://github.com/dengzemiao/DZMLuckyDraw.git
正克隆到 'DZMLuckyDraw'...
error: RPC failed; result=35, HTTP code = 0
fatal: The remote end hung up unexpectedly
复制代码
git clone
特别慢,是由于 github.global.ssl.fastly.net
域名被限制了,只要找到这个域名对应的 IP
地址,而后在 hosts
文件中加上 ip–>域名
的映射,刷新 DNS
缓存即可。github
nslookup
命令获取 github
IP
地址vim
一、若是没有安装,则须要安装一下centos
$ yum -y install bind-utils
复制代码
二、获取 IP
地址缓存
$ nslookup github.global.ssl.fastly.net
$ nslookup github.com
复制代码
修改 hosts
文件服务器
一、编辑 hosts
markdown
$ sudo vim /etc/hosts
复制代码
二、填入内容,保存spa
格式:
x.x.x.x http://global-ssl.fastly.net
x.x.x.x http://github.com
例如拿上面获得的IP地址:
69.171.229.73 http://global-ssl.fastly.net
13.250.177.223 http://github.com
复制代码
nscd
命令更新 DNS
缓存.net
一、若是没有安装,则须要安装一下3d
$ yum install -y nscd
复制代码
二、更新 DNS
缓存
$ nscd -i hosts
复制代码
而后再次执行 git clone
,则会进入下载。
[root@VM-0-11-centos home]# git clone https://github.com/dengzemiao/DZMLuckyDraw.git
正克隆到 'DZMLuckyDraw'...
remote: Enumerating objects: 2644, done.
remote: Counting objects: 100% (2644/2644), done.
remote: Compressing objects: 100% (1562/1562), done.
接收对象中: 1% (41/2644), 897.00 KiB | 897.00 KiB/s
复制代码