我在谷歌上搜索过,找到了很多解决方案,但没有一个适合我。

我试图通过连接到LAN网络中的远程服务器从一台机器克隆。 在另一台机器上运行此命令会导致错误。 但是使用git运行相同的克隆命令://192.168.8.5…在服务器上,这是正常的并且成功的。

有什么想法吗?

user@USER ~
$ git clone  -v git://192.168.8.5/butterfly025.git
Cloning into 'butterfly025'...
remote: Counting objects: 4846, done.
remote: Compressing objects: 100% (3256/3256), done.
fatal: read error: Invalid argument, 255.05 MiB | 1.35 MiB/s
fatal: early EOF
fatal: index-pack failed

我已经在.gitconfig中添加了这个配置,但也没有帮助。 使用git版本为1.8.5.5.2 .msysgit.0

[core]
    compression = -1

当前回答

几乎所有的答案都试过了,但运气不佳。最后,通过使用Github桌面应用程序https://desktop.github.com/,它成功了

带有M1芯片的Macbook /Monterey不确定这是否重要。

其他回答

首先,关闭压缩:

git config --global core.compression 0

接下来,让我们做一个部分克隆来截断下来的信息量:

git clone --depth 1 <repo_URI>

当它工作时,进入新目录并检索克隆的其余部分:

git fetch --unshallow 

或者,或者,

git fetch --depth=2147483647

现在,做一个常规的拉:

git pull --all

我认为在1.8版本中msysgit有一个小故障。x版本会加剧这些症状,因此另一种选择是尝试较早版本的git(我认为<= 1.8.3)。

这些对我来说都没用,但使用Heroku的内置工具却奏效了。

heroku git:clone -a myapp

文档在这里:https://devcenter.heroku.com/articles/git-clone-heroku-app

使用@cmpickle答案,我构建了一个脚本来简化克隆过程。

它托管在这里:https://gist.github.com/gianlucaparadise/10286e0b1c5409bd1049d67640fb7c03

你可以使用下面的代码行运行它:

curl -sL https://git.io/JvtZ5 | sh -s repo_uri repo_folder

虽然不是完全相同的设置,但我在Ubuntu 20.04上挂载nfs共享时遇到了这个问题。我还没有找到任何解决方案,所以我分享了我是如何解决的,希望我能帮助到别人。

错误消息是(有时带有/没有警告):

warning: die() called many times. Recursion error or racy threaded death!
fatal: premature end of pack file, 29 bytes missing
fatal: premature end of pack file, 24 bytes missing
fatal: index-pack failed

Git浅克隆,禁用压缩等并没有解决这个问题。

当我用nfsvers=4.2而不是nfsvers=4.0挂载共享时,问题消失了。

正如@ingyhere所说:

浅克隆

首先,关闭压缩:

git config --global core.compression 0

接下来,让我们做一个部分克隆来截断下来的信息量:

git clone --depth 1 <repo_URI>

当它工作时,进入新目录并检索克隆的其余部分:

git fetch --unshallow

或者,或者,

git fetch --depth=2147483647

现在,拉一下:

git pull --all

然后解决你本地分支只跟踪主的问题

在您选择的编辑器中打开git配置文件(.git/config)

上面写着:

[remote "origin"]
    url=<git repo url>
    fetch = +refs/heads/master:refs/remotes/origin/master

换线

fetch = +refs/heads/master:refs/remotes/origin/master

to

fetch = +refs/heads/*:refs/remotes/origin/*

做一个git取回和git将拉你所有的远程分支现在