git 拉出警告时出错:次优包 - 内存不足

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9040083/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 06:23:56  来源:igfitidea点击:

Error when pulling warning: suboptimal pack - out of memory

git

提问by wowzuzz

I keep getting this error when trying to do a git?pullor a git?gc.

尝试执行 agit?pull或 a时,我不断收到此错误git?gc

warning: suboptimal pack - out of memory 
Compressing objects: 100% (10955/10955), done.
fatal: Out of memory, malloc failed (tried to allocate 827101023 bytes)
error: failed to run repack

How would I go about fixing this?

我将如何解决这个问题?

回答by VonC

This threadsuggests

这个线程建议

run git repack -adf --window=memoryon the repo where memory is escalated appropriately for your machine.

git repack -adf --window=memory在 repo 上运行,其中内存为您的机器适当升级。

That is pretty much the same solution than for the SO question "Repack of Git repository fails".

这与 SO 问题“重新打包 Git 存储库失败”的解决方案几乎相同。

git repack -a -d --window-memory 10m --max-pack-size 20m

However, Mark Longairwill warn you that:

但是,Mark Longair警告您

Your solution has got you a working copy locally and remotely, but will cause problems again when the remote repository decides to repack itself again.

您的解决方案为您提供了本地和远程的工作副本,但是当远程存储库决定再次重新打包时,将再次导致问题。

So configuring pack.windowMemoryand pack.packSizeLimitis a much safer solution, as well as checking the config of core.packedxxxand core.deltaxxx.

所以配置pack.windowMemoryandpack.packSizeLimit是一个更安全的解决方案,以及检查core.packedxxxand的配置core.deltaxxx

For msysGit on Windows, this comment mentions:

对于 Windows 上的 msysGit,此评论提到:

git config --global pack.windowMemory 256m

worked for me (had have memory alloc error on 64 bit windows (Git-1.7.6-preview20110708.exe)

对我来说有效(在 64 位窗口上有内存分配错误(Git-1.7.6-preview20110708.exe)

回答by jamie_y

Running

跑步

git repack -a -d --window-memory 10m --max-pack-size 20m

did not really solve my problem.

并没有真正解决我的问题。

Removing the repository and then git cloning again solved the problem.

删除存储库,然后再次 git cloning 解决了问题。