我有一个git存储库,位于内存有限的服务器上。当我尝试从服务器克隆现有的存储库时,我得到了以下错误
hemi@ubuntu:$ git clone ssh://hemi@servername.dk/home/hemi/repos/articles
Initialized empty Git repository in /home/hemi/Skrivebord/articles/.git/
hemi@servername.dk's password:
remote: Counting objects: 666, done.
remote: warning: suboptimal pack - out of memory
remote: fatal: Out of memory, malloc failed
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: early EOF
fatal: index-pack failed
hemi@ubuntu:$
为了处理这个错误,我尝试重新打包原始存储库(根据this forum post)。但它并没有重新打包存储库,而是描述了如何使用"git pack-objects“命令。
hemi@servername:~/repos/articles$ git repack -a -d --window-memory 10m --max-pack-size 100m
usage: git pack-objects [{ -q | --progress | --all-progress }]
[--all-progress-implied]
[--max-pack-size=N] [--local] [--incremental]
[--window=N] [--window-memory=N] [--depth=N]
[--no-reuse-delta] [--no-reuse-object] [--delta-base-offset]
[--threads=N] [--non-empty] [--revs [--unpacked | --all]*]
[--reflog] [--stdout | base-name] [--include-tag]
[--keep-unreachable | --unpack-unreachable
[<ref-list | <object-list]
服务器上安装了Git 1.6.5.7。
发布于 2013-08-11 17:16:45
由于无法直接访问存储库,因此无法执行重新打包,因此执行浅克隆,然后逐渐获取,同时增加深度对我有帮助。
git clone YOUR_REPO --depth=1
git fetch --depth=10
...
git fetch --depth=100
git fetch --unshallow //Downloads all history allowing to push from repo
希望它还能帮助到某些人。
发布于 2011-10-05 18:35:57
这并没有回答这个问题,但有人可能会遇到这个问题:当pack-objects
被某种内存杀手终止时,服务器上的重新打包也可能失败:
$ git clone project-url project-folder
Cloning into project-folder...
remote: Counting objects: 6606, done.
remote: Compressing objects: 100% (2903/2903), done.
error: pack-objects died of signal 9284.51 MiB | 2.15 MiB/s
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: early EOF
fatal: index-pack failed
在Dreamhost上,这似乎是由mmap
引起的。repack代码使用mmap
将一些文件的内容映射到内存中,由于内存杀手不够智能,它会将mmap
文件计为已用内存,从而在尝试将大文件打包时终止Git进程。
解决方案是在关闭mmap
支持(configure NO_MMAP=1
)的情况下编译自定义的Git二进制文件。
发布于 2011-01-28 17:47:27
我使用的是git版本1.7.0.4,它接受这个命令。git版本1.6可能不接受此命令。
尝试使用一些随机提交创建一个新的存储库。然后使用这个命令重新打包它。
https://stackoverflow.com/questions/4826639
复制相似问题