git clone,上载内存不足 [英] git clone, upload-pack out of memory

查看:296
本文介绍了git clone,上载内存不足的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个git repo,它仅以二进制形式存储PDF,总共有70个PDF,总计130MB,其中一些很大(约15MB). 当我尝试将存储库克隆到我的工作计算机时,出现错误:

I have a git repo that stores only PDFs as binaries, in total there are 70 PDFs totalling 130MB, a few of them are large (about 15MB). When I try to clone the repo to my work computer I get the error:

remote: Counting objects: 93, done.
remote: fatal: Out of memory, malloc failed (tried to allocate 36864964 bytes)
error: git upload-pack: git-pack-objects died with error.
fatal: git upload-pack: aborting due to possible repository corruption on the remote side.
remote: aborting due to possible repository corruption on the remote side.
fatal: protocol error: bad pack header

其他一些git答案声称已通过重新打包存储库来解决此问题. 当我尝试在服务器回购上git repack --max-pack-size=5M -a -dgit gc时,出现相同的malloc错误.

Some other git answers have claimed to have fixed this by repacking the repo. When I try to git repack --max-pack-size=5M -a -d or git gc on the server repo I get the same malloc error.

git服务器位于1and1提供的我的个人Web空间上,我认为它不允许我在此过程中使用36864964字节的内存.

The git server is on my personal webspace offered by 1and1, I have the idea that it is not allowing me to use 36864964 bytes of memory in the process.

如何将服务器存储库克隆到本地计算机上?

How can I clone the server repo on to my local computer?

这是在服务器上运行的ulimit -a的输出:

Here is the output of ulimit -a run on the server:

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) 131072
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 48165
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) unlimited
cpu time               (seconds, -t) 1800
max user processes              (-u) 90
virtual memory          (kbytes, -v) 131072
file locks                      (-x) unlimited

谢谢.

推荐答案

我尝试了nif的注释,并通过sftp下载了回购协议. 然后,我使用git repack --max-pack-size=3M -a -d以非常小的packsize重新包装了它. 然后,我将其上传回服务器.

I tried nif's comment and downloaded the repo via sftp. I then repacked it at a very low packsize using git repack --max-pack-size=3M -a -d. I then uploaded it back to the server.

这时我遇到了另一个错误:fatal: unable to create thread: Resource temporarily unavailable.在这一点上,我几乎可以肯定这是由于主机的低内存(可能是线程)配置导致的资源分配问题.

At this point I got another error: fatal: unable to create thread: Resource temporarily unavailable. At this point I am almost certain that this was a resource allocation problem resulting from my host's low-memory (and perhaps threads) configuration.

找到此stackexchange问​​题后: git push致命:无法创建线程:资源暂时不可用并设置:

After finding this stackexchange question: git push fatal: unable to create thread: Resource temporarily unavailable and setting:

git config pack.windowMemory "15m"
git config pack.SizeLimit "3m"
git config pack.threads "1"

(选择的数字任意低)

我现在可以从本地计算机成功克隆服务器存储库! 我怀疑如果从一开始就用上面的三行配置git,我就不会遇到这个问题.

I can now successfully clone the server repo from my local computer! I suspect that if I had configured git with the three lines above from the beginning I would not have had this problem.

再次感谢您nif!

这篇关于git clone,上载内存不足的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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