您好,欢迎访问一九零五行业门户网

git 克隆失败怎么办

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 remainingfatal: the remote end hung up unexpectedlyfatal: early eoffatal: 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 mdnsrespondersudo dscacheutil -flushcache
结果再执行 git clone 的操作的时候,速度飕飕飕的上去了,一下子达到几百kb啦~
推荐学习:《git教程》
以上就是git 克隆失败怎么办的详细内容。
其它类似信息

推荐信息