Git Error: pack-objects died, out of memory

Phanix
·
·
IPFS
·

紀錄一下…

今天遇到的,不過其實該 repository 也沒有很大的檔案,但是在 clone 的時候就會在 Compresing objects 的時候掛掉,然後回來這樣的錯誤訊息。

$ git clone git@SERVER:NS/PROJECT.git Cloning into 'PROJECT'...
remote: Counting objects: 3081, done.
remote: warning: suboptimal pack - out of memory
error: pack-objects died of signal 95/1154)   
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

解決方法是從 server 上強制太大的檔案不要 compress,直接在 clone 的時候做下載。

/var/opt/gitlab/git-data/repositories/NS/PROJECT.git$ more config
[core]
	repositoryformatversion = 0
	filemode = true
	bare = true
[remote "origin"]
	url = /var/opt/gitlab/backups/repositories/NS/PROJECT.bundle
	fetch = +refs/*:refs/*
	mirror = true

/var/opt/gitlab/git-data/repositories/NS/PROJECT.git$ git config pack.windowMemory 10m
/var/opt/gitlab/git-data/repositories/NS/PROJECT.git$ git config pack.packSizeLimit 20m

/var/opt/gitlab/git-data/repositories/NS/PROJECT.git$ more config
[core]
	repositoryformatversion = 0
	filemode = true
	bare = true
[remote "origin"]
	url = /var/opt/gitlab/backups/repositories/NS/PROJECT.bundle
	fetch = +refs/*:refs/*
	mirror = true
[pack]
	windowMemory = 10m
	packSizeLimit = 20m

Original link: Phanix's Blog

CC BY-NC-ND 2.0 授权

喜欢我的作品吗?别忘了给予支持与赞赏,让我知道在创作的路上有你陪伴,一起延续这份热忱!