github下载慢或报错“The-remote-end-hung-up-unexpectedly”解决办法:该问题往往因为内部网络限制等因素导致。
因细节更新,欢迎访问本文源站链接:https://turbock79.cn/?p=173。
1.方法一
解决gitbub下载慢问题,可尝试设置缓存大小设定
1 2 3 |
git config --global http.postBuffer 1048576000 git config --global http.lowSpeedLimit 0 git config --global http.lowSpeedTime 999999 |
2.方法二
解决gitbub下载慢问题,在方法一基础上,尝试方法二,采用SSH或https传输协议克隆。同时限定下载文件内容大小
- 仅下载某分支
1 |
git clone -b stable/1908 "ssh://XXXXX@gerrit.fd.io:29418/vpp" |
- 下载深度设定 1,然后下载完某项目后,再下载指定内容。
1 2 3 |
git clone --depth=1 "ssh://XXXXX@gerrit.fd.io:29418/vpp" git fetch --all git reset --hard origin/master |
3.方法三
gitbub下载慢,主要因为DNS问题。在非限制网络环境下(公司网络限制较多,可换为个人热点,家庭路由等),修改hosts文件。在https://www.ipaddress.com 查找 http://github.com
和 http://global-ssl.fastly.Net
对应的IP地址,或采用ping命令查询到IP。这些IP会随着主网站变化而改变,所以需要使用时经常更新。
建议采用dig/nslookup
的命令查询到IP。
1 2 3 4 5 6 7 |
#安装bind-utils用于dns解析查询,dig/nslookup等命令(可选操作) yum install -y bind-utils dig github.com dig github.global.ssl.fastly.net #例如: #1. `13.250.177.223` 对应的 `github.com` #2. `31.13.80.1` 对应的 `github.global.ssl.fastly.net` |
- 在linux/Mac下:
-
打开文件路径
/etc/hosts
,拷贝出该hosts
文件; -
将下列内容加入到拷贝出的
hosts
文件中:123452.74.223.119 github.com199.59.150.11 github.global.ssl.fastly.net151.101.0.249 global-ssl.fastly.net185.199.111.153 assets-cdn.github.com -
用拷贝出的文件替换
hosts
文件; -
打开终端:输入以下内容,刷新DNS缓存:yum install -y nscd;
sudo service nscd restart, 或者重启。
- 在Windows下:
-
用记事本打开
hosts
文件(路径在:C:\Windows\System32\drivers\etc\hosts
) -
将下列内容加入到拷贝出的
hosts
文件中:123413.250.177.223 github.com31.13.80.1 github.global.ssl.fastly.net151.101.184.249 global-ssl.fastly.net185.199.111.153 assets-cdn.github.com -
打开终端:输入以下内容,刷新DNS缓存:
ipconfig /flushdns
4.方法四
采用github代理,https://ghproxy.com/
1 2 3 4 5 6 7 8 |
#git clone git clone https://ghproxy.com/https://github.com/stilleshan/ServerStatus #wget & curl wget https://ghproxy.com/https://github.com/stilleshan/ServerStatus/archive/master.zip wget https://ghproxy.com/https://raw.githubusercontent.com/stilleshan/ServerStatus/master/Dockerfile curl -O https://ghproxy.com/https://github.com/stilleshan/ServerStatus/archive/master.zip curl -O https://ghproxy.com/https://raw.githubusercontent.com/stilleshan/ServerStatus/master/Dockerfile |
5.方法五
大哥,您还是换个网络吧。移动热点也行,网速至少能快一点。不过有些情况下,换网也没用,下载完成后仍然会终止。
赞赏微信赞赏
支付宝赞赏