当我试图从GitLab (GitLab 6.6.2 4ef8369)克隆一个存储库时,我遇到了这个错误:
remote: Counting objects: 66352, done.
remote: Compressing objects: 100% (10417/10417), 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
然后中止克隆。我该如何避免这种情况?
git clone --global core.compression 0
then
git clone --depth=1 <https://your_repo.git>
then
git fetch --depth=2
then
git fetch --depth=10
...
等等,直到他写到
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
最后你可以写
git fetch --unshallow
你会被扔出去
fatal: --unshallow on a complete repository does not make sense
如果在某个阶段再次得到错误,请尝试将——depth属性设置为较小的值并逐渐进一步增加
这种情况的发生通常是由于以下原因之一:
缓慢的互联网。
切换到网络连接稳定的局域网电缆在很多情况下都有帮助。在获取时避免执行任何并行网络密集型任务。
服务器端TCP/IP连接超时。
你也无能为力。您所能做的就是请求系统管理员或CI/CD团队增加etcp /IP超时时间并等待。
服务器负载过重。
由于工作时间服务器负载过重,下载大文件可能会不断失败。晚上开始下载后离开你的机器。
客户端机器上的小HTTPS缓冲区。
增加post和request的缓冲区大小可能会有所帮助,但不能保证
Git配置——global http。postBuffer 524288000
Git配置——global http。maxRequestBuffer 524288000
Git配置——global core.compression 0