问题:使用git命令过去版本库文件时遇到如下错误
emote: fatal: Out of memory, malloc failed (tried to allocate 428284644 bytes) remote: aborting due to possible repository corruption on the remote side. Receiving objects: 94% (5982/6334), 221.66 MiB | 5.84 MiB/s
处理方案:
方案1、通过git命令先获取第一层的文件目录,然后再更新
方案2、版本库瘦身
# 查看历史大文件
git rev-list --objects --all | grep "$(git verify-pack -v .git/objects/pack/*.idx | sort -k 3 -n | tail -5 | awk '{print$1}')"
# 从历史中删除 target/ 这个文件夹
git filter-branch --force --index-filter 'git rm -r --cached --ignore-unmatch target/' --prune-empty --tag-name-filter cat -- --all
# 执行仓库压缩
git gc --prune=now
# 推送到远程仓库
git push origin --force --all



