git远程克隆仓库报错`fatal: The remote end hung up unexpectedly`

文章目录


git远程克隆仓库报错 fatal: The remote end hung up unexpectedly

所以在此记录一下解决方案,主要是网速太慢的原因。

思路

  • 找到对应域名的ip地址,然后在hosts文件中加上ip–>域名的映射,刷新DNS缓存便可

实施

  • 在网站 https://www.ipaddress.com/ 分别搜索:
github.global.ssl.fastly.net
github.com

得到ip:

git远程克隆仓库报错`fatal: The remote end hung up unexpectedly`

git远程克隆仓库报错`fatal: The remote end hung up unexpectedly`

编辑hosts文件

vim /etc/hosts

添加如下内容

199.232.69.194 github.global.ssl.fastly.net
140.82.112.3 github.com

保存更新DNS,安装nscd

yum install -y nscd

刷新这个守护进程

service nscd restart

但是克隆远程仓库又报错:fatal: Out of memory, malloc failed (tried to allocate 1048576000 bytes)

还是网络慢的原因,所以需要设置git配置参数,否则因此超时退出

git参数配置

cgit参数配置如下:

git config --global http.lowSpeedLimit 0
git config --global http.lowSpeedTime 999999
git config --global http.postBuffer 5242880

完成,试试git clone这条命令速度如何?

上一篇:git问题汇总(不定时更新)


下一篇:"fatal error C1859: 意外的预编译头错误,只需重新运行编译器就可能修复此问题"如何解决?