clone
大仓库失败的解决过程,以下问题与解决方案均基于 https
访问。
从web
端查看仓库大小,大约1.5G
左右,首先直接执行git clone
,报错如下:
remote: Counting objects: 10994, done.
remote: Compressing objects: 100% (3085/3085), done.
error: RPC failed; curl 56 GnuTLS recv error (-110): The TLS connection was non-properly terminated.
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
在增大postBuffer
的同时,关闭ssl
认证:
$ git config --global http.postBuffer 2048000000 # 设置为2G
$ git config --global http.sslVerify false # 关闭sslVerify
设置成功后,重新clone
,错误依旧。
1.安装相关依赖环境:
$ sudo apt-get install build-essential fakeroot dpkg-dev libcurl4-openssl-dev
2.获取git源码:
$ sudo apt-get source git
若出现如下错误:
E: You must put some 'source' URIs in your sources.list
则需要将设置->Software & Updates
->Ubuntu Software
->Source code
勾选:
若出现如下错误:
couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied) [duplicate]
则需要更改权限:
sudo chown _apt /var/lib/update-notifier/package-data-downloads/partial/
3.安装git
的依赖
$ sudo apt-get build-dep git
4.进入git
目录,重新编译:
$ cd git-2.7.4/
$ vim ./debian/control # 将libcurl4-gnutls-dev修改为libcurl4-openssl-dev
$ vim ./debian/rules # 整行删除TEST=test
$ sudo dpkg-buildpackage -rfakeroot -b -uc -us -j4 # 编译
5.回到上一级目录,安装编译好的安装包:
$ cd ..
$ sudo dpkg -i git_2.7.4-0ubuntuxxx_amd64.deb # 安装包名字可能有所不同
执行完成如上步骤后,重新clone
,发现依旧报错,请看错误二。
remote: Counting objects: 10994, done.
remote: Compressing objects: 100% (3085/3085), 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
重新确认postBuffer
,配置确实生效了:
$ cat ~/.gitconfig
[http]
sslVerify = false
postBuffer = 2048000000
晕,实在搞不定了,采取极端方法,首先clone
一层:
$ git clone --depth=1 http://xxx.git
浅层clone
成功后,再完整拉取:
$ git fetch --unshallow # 拉取完整当前分支
$ git remote set-branches origin '*' # 追踪所有远程分支
$ git fetch -v # 拉取所有远程分支
至此,终于成功地clone
了一个完整的仓库。
微信公众号同步更新,微信搜索"AnSwEr不是答案"或者扫描二维码,即可订阅。