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

我试图通过连接到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

当前回答

请注意,Git 2.13.x/2.14(2017年第三季度)确实引发了默认核心。影响git取回的packedGitLimit: 在较大的平台上,默认的package -git限制值已经提高(从8 GiB提高到32 GiB),以避免“gc”并行运行时“git获取”(可恢复的)失败。

参见David Turner (csusbdt)的commit be4ca29(2017年4月20日)。 帮助:Jeff King (peff)。 (由Junio C Hamano—gitster—在commit d97141b中合并,2017年5月16日)

Increase core.packedGitLimit When core.packedGitLimit is exceeded, git will close packs. If there is a repack operation going on in parallel with a fetch, the fetch might open a pack, and then be forced to close it due to packedGitLimit being hit. The repack could then delete the pack out from under the fetch, causing the fetch to fail. Increase core.packedGitLimit's default value to prevent this. On current 64-bit x86_64 machines, 48 bits of address space are available. It appears that 64-bit ARM machines have no standard amount of address space (that is, it varies by manufacturer), and IA64 and POWER machines have the full 64 bits. So 48 bits is the only limit that we can reasonably care about. We reserve a few bits of the 48-bit address space for the kernel's use (this is not strictly necessary, but it's better to be safe), and use up to the remaining 45. No git repository will be anywhere near this large any time soon, so this should prevent the failure.

其他回答

下面的配置设置不适合我。

[core] 
packedGitLimit = 512m 
packedGitWindowSize = 512m 
[pack] 
deltaCacheSize = 2047m 
packSizeLimit = 2047m 
windowMemory = 2047m

正如之前的评论,这可能是git的内存问题。 因此,我尽量减少工作线程(从32个减少到8个),这样它就不会同时从服务器获取太多数据。然后我还添加了“-f”来强制同步其他项目。

-f: Proceed with syncing other projects even if a project fails to sync.

那么现在可以正常工作了。

repo sync -f -j8

请注意,Git 2.13.x/2.14(2017年第三季度)确实引发了默认核心。影响git取回的packedGitLimit: 在较大的平台上,默认的package -git限制值已经提高(从8 GiB提高到32 GiB),以避免“gc”并行运行时“git获取”(可恢复的)失败。

参见David Turner (csusbdt)的commit be4ca29(2017年4月20日)。 帮助:Jeff King (peff)。 (由Junio C Hamano—gitster—在commit d97141b中合并,2017年5月16日)

Increase core.packedGitLimit When core.packedGitLimit is exceeded, git will close packs. If there is a repack operation going on in parallel with a fetch, the fetch might open a pack, and then be forced to close it due to packedGitLimit being hit. The repack could then delete the pack out from under the fetch, causing the fetch to fail. Increase core.packedGitLimit's default value to prevent this. On current 64-bit x86_64 machines, 48 bits of address space are available. It appears that 64-bit ARM machines have no standard amount of address space (that is, it varies by manufacturer), and IA64 and POWER machines have the full 64 bits. So 48 bits is the only limit that we can reasonably care about. We reserve a few bits of the 48-bit address space for the kernel's use (this is not strictly necessary, but it's better to be safe), and use up to the remaining 45. No git repository will be anywhere near this large any time soon, so this should prevent the failure.

我尝试了这里提出的所有建议,但没有一个奏效。对我们来说,这个问题是不稳定的,而且随着回购的规模越来越大(在Jenkins Windows构建奴隶上),情况变得越来越糟。

它最终成为git使用的ssh版本。Git被配置为使用某个版本的Open SSH,在用户的.gitconfig文件中通过内核指定。sshCommand变量。把那条线拆了,它就固定了。我相信这是因为Windows现在提供了一个更可靠/兼容的SSH版本,默认使用。

我也有同样的问题,我甚至试图直接从网站下载项目作为一个压缩文件,但下载被中断在完全相同的百分比。

这句话像魔法一样解决了我的问题

git config --global core.compression 0

我知道其他答案也提到了这一点,但是这里没有人提到这条线本身就可以解决问题。

希望能有所帮助。

连接的问题

这是最有可能的原因。特别是如果你的git是最新的。(你可以更新你的git,如果不是最新的)

1-检查连接是否稳定。 2- VPN =>禁用它(如果使用=>罪魁祸首) 3-防病毒和防火墙

VPN VPN VPN =>罪魁祸首

Git缓存,缓冲区,内存和压缩

其他答案很好地涵盖了这一点。

会选https://stackoverflow.com/a/29355320/7668448

使用实例使用cli打开全局配置。

git config --global -e

如果没有,则:

https://stackoverflow.com/a/22317479/7668448