git 克隆失败怎么办
时间:2021-12-15 来源:互联网
今天PHP爱好者为您带来git克隆失败的解决办法:1、执行“git config --global http.postBuffer 524288000”命令;2、将IP地址添加到/etc/hosts中;3、刷新dns缓存。希望对大家有所帮助。
本文操作环境:Windows10系统、Git 2.30.0版、Dell G3电脑。
git 克隆失败怎么办?
使用 git 克隆 github 上的项目失败
现象
今天在使用 git clone nextjs demo project 源代码的时, git clone https://github.com/XXXX/next-blog.git
下载速度很慢,然后下载一段时间后,总是提示下面的错误信息
nCloning into 'next-blog'...
remote: Enumerating objects: 111, done.
remote: Counting objects: 100% (111/111), done.
remote: Compressing objects: 100% (83/83), done.
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
原因
由于Http协议错误,当 pull 或者 clone 的时候,或者是 github 某个CDN被伟大的墙屏蔽所致。
解决办法
协议错误
先执行下列命令
git config --global http.postBuffer 524288000
再执行git pull 或者 git clone命令
墙屏蔽
访问 http://github.global.ssl.fast...
获取cdn域名以及IP地址访问 http://github.com.ipaddress.c... 获取cdn域名以及IP地址
将上述获取的IP地址添加到
/etc/hosts
中sudo vim /etc/hosts
刷新dns缓存
sudo killall -HUP mDNSResponder
sudo dscacheutil -flushcache
结果
再执行 git clone 的操作的时候,速度飕飕飕的上去了,一下子达到几百Kb啦~
以上就是git 克隆失败怎么办的详细内容,更多请关注php爱好者其它相关文章!
-
闪耀优俊少女9月有哪些活动-优俊少女9月活动前瞻 2025-08-27
-
错误代码678怎么解决 快速修复网络连接问题的方法 2025-08-27
-
电脑宽带连接错误代码769怎么解决?快速修复方法详解 2025-08-27
-
Binance充值方法大全:快速安全入金指南 2025-08-27
-
偃武华佗强度怎么样-偃武华佗角色技能解析 2025-08-27
-
无畏契约怎么对好友隐身-隐身设置方法详细说明 2025-08-27