首先,让我解释一下背景:
我需要将一个至关重要的Magento网店升级到新版本。为了确保升级后所有现有代码仍然能正常工作,并做出一些升级后的更改,我从整个Magento安装中(不包括明显的内容,如4.5GB的图像、./var目录等)创建了一个Git存储库,将其推送到origin并在开发服务器上克隆了它。创建了一个新分支,执行了升级、代码更改,将所有内容提交到开发分支并推送回origin。
现在是时候升级“真正”的商店了,也就是说,我需要将生产服务器上的主分支与开发分支合并。但是接下来的一切都出了问题:
git fetch
- 可行
git branch
说:* master
git merge origin/dev
出现不可描述的错误(经过一些等待后才有输出):
fatal: Out of memory? mmap failed: Cannot allocate memory
对于 git checkout dev
, git rebase master origin/dev
等也都有同样的问题。
在 stackoverflow 上查阅了现有的问题并尝试了几种建议,包括但不限于:
git gc
Counting objects: 48154, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (37152/37152), done.
fatal: Out of memory, malloc failed (tried to allocate 527338875 bytes)
error: failed to run repack
并且:
git repack -a -d --window-memory 10m --max-pack-size 20m
Counting objects: 48154, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (37152/37152), done.
fatal: Out of memory, malloc failed (tried to allocate 527338875 bytes)
除了之前的命令,我还尝试了这个(它非常相似)。 由于链接提到可能存在32位系统问题,因此最好提供涉及三个系统规格的详细信息:
- 'dev' 服务器: x86_64 Gentoo 2.6.38-hardened-r6 // 4核 & 8GB RAM
- 'origin' 服务器: x86_64 Gentoo 2.6.38-hardened-r6 // 2核 & 4GB RAM
- 'live' 服务器: x86_64 Debian 4.3.2-1.1 2.6.35.5-pv1amd64 // (VPS) 2核 & 3GB RAM
有人知道我该如何恢复吗?在 'origin' 上重新打包有效吗?如果有效,我怎样才能说服生产服务器获取仓库的新副本? 非常感谢任何帮助!