webネタ

Webエンジニアが業務に関係することをメモしていく

gitで重いリポジトリをcloneするとき

git clone http://example.com/fuga.git

remote: Counting objects: 3203, 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: protocol error: bad pack header

エラーになるので少しずつ落とす

git clone --depth 1 http://example.com/fuga.git
git fetch --depth 10
git fetch --depth 100 # 値は調整しつつ
git fetch --unshallow # 最後に全部落とす このオプションは最新のgitでないとない