4

サーバーには 64MB のメモリしかありません。巨大な git リポジトリをそれにプッシュしようとしています。最初は、ターゲット ディレクトリには空のベア リポジトリが含まれています。プッシュは失敗します:

$ git push server:/tmp/repo master
Counting objects: 3064514, done.
Compressing objects: 100% (470245/470245), done.
fatal: Out of memory, calloc failed 
error: pack-objects died of signal 13
error: failed to push some refs to 'server:/tmp/repo'
$ ssh server cat /tmp/repo.git/config
[pack]
        threads = 1
        deltaCacheSize = 8m
        windowMemory = 32m
[core]
        repositoryformatversion = 0
        filemode = true
        bare = true

サーバーで変更した後、同じエラー メッセージが表示git config pack.windowMemory 16mされます。

同じプッシュが localhost に成功します。

$ git push 127.0.0.1:/tmp/repo master
Password: 
Counting objects: 3064514, done.
Compressing objects: 100% (470245/470245), done.
Writing objects: 100% (3064514/3064514), 703.02 MiB | 10.84 MiB/s, done.
Total 3064514 (delta 2569775), reused 3059081 (delta 2565342)
To 127.0.0.1:/tmp/repo
 * [new branch]      master -> master

git configプッシュを成功させるリモート設定はありますか? または、プッシュする前にレポをローカルに再パックする必要がありますか (どの設定で)?

より多くのメモリを搭載した別のサーバーを使用することはオプションではないことに注意してください。オプションで、既存のサーバーに最大 96MB のメモリを追加できます。メモリ制限に達している場合は、サーバー上で通常よりも多くのディスク領域を使用しても問題ありません。

有効な解決策のない同様の質問: https://serverfault.com/questions/372899/git-fails-to-push-with-error-out-of-memory

リポジトリをローカルに再パックしても解決せずgit push、同じエラーが出力されます。ローカル リポジトリで設定を再パックします。

git config core.packedgitlimit 32m
git config core.packedgitwindowsize=32m
git config pack.threads 1
git config pack.deltacachesize 8m
git config pack.windowmemory 32m
git config pack.packsizelimit 500m

私の考えでは、失敗する理由は、オブジェクトの総数が多すぎるためです。SHA-1 ハッシュでさえ収まりません (20 * 3064514バイトはほぼ 64MB です)。

4

0 に答える 0