git clone fatal: index-pack failed

查看:727
本文介绍了git clone fatal: index-pack failed的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

最近一直没解决 git clone 时出现中断的问题

Cloning into '/Users/Sirormy/sdk/clang/fastcomp/src'...
remote: Counting objects: 1225089, done.
remote: Compressing objects: 100% (22/22), done.
error: RPC failed; result=18, HTTP code = 20050 MiB | 1.08 MiB/s
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
['/usr/bin/git', 'clone', 'https://github.com/kripken/em...', '/Users/Sirormy/sdk/clang/fastcomp/src'] failed with error code 128!
Installation failed!

基本靠谱的回答都看了一遍, 基本是如下几种:

有人说这样

git config --global core.compression -1

或者修改 ~/.gitconfig

    autocrlf = input
    excludesfile = /Users/Sirormy/.gitignore_global
    packedGitLimit = 5120m
    packedGitWindowSize = 5120m
    compression = 1
[difftool "sourcetree"]
    cmd = opendiff \"$LOCAL\" \"$REMOTE\"
    path =
[mergetool "sourcetree"]
    cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
    trustExitCode = true
[commit]
    template = /Users/Sirormy/.stCommitMsg
[pack]
    deltaCacheSize = 5120m
    packSizeLimit = 5210m
    windowMemory = 5210m
[http]
    postBuffer = 1048576000

还有 Stackoverflow 上得票最高的, 这样

First, turn off compression:

git config --global core.compression 0
Next, let's do a partial clone to truncate the amount of info coming down:

git clone --depth 1 <repo_URI>
When that works, go into the new directory and retrieve the rest of the clone:

git fetch --unshallow 
or, alternately,

git fetch --depth=2147483647
Now, do a regular pull:

git pull --all

测试中型项目使用这几种方法能够解决, 但超大项目比如我clone emscripten的时候就会有问题, 大约50M左右的时候就会报上述错误.

git 重装过依然没有解决, 排除了git软件本身的问题, 目前版本是

git version 2.3.2 (Apple Git-55)

由于某些场景是代码中自动拉取的 git 资源, 所以手动下载不能解决所有问题

所以我该怎么办? 如果你有解决方法, 请测试一下然后告诉我

git clone https://github.com/kripken/emscripten.git

项目有些大, 但是如果下载超过59M还没有错误的话, 那就是答案了.

谢谢~

解决方案

执行 git repack -a -f -d --window=250 --depth=250 即可。

如果还是报错则请执行:

git gc --aggressive

git repack -a -f -d --window=250 --depth=250

也可以更换为 SSH 地址:

git clone git@github.com:kripken/emscripten.git

Debug 文档:https://coding.net/help/faq/g...

这篇关于git clone fatal: index-pack failed的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆