-
在
CentOS 服务器
上通过git clone
下载项目,速度很慢或直接超时[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
缓存便可。 -
nslookup
命令获取github
IP
地址1、如果没有安装,则需要安装一下
$ yum -y install bind-utils
2、获取
IP
地址$ nslookup github.global.ssl.fastly.net $ nslookup github.com
-
修改
hosts
文件1、编辑
hosts
$ sudo vim /etc/hosts
2、填入内容,保存
格式: 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
缓存1、如果没有安装,则需要安装一下
$ yum install -y nscd
2、更新
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
CentOS 服务器 git clone下载加速(下载过慢或超时)
最新推荐文章于 2024-08-22 16:40:29 发布