清理git服务器上的大文件 [英] Clean up large files on git server

查看:364
本文介绍了清理git服务器上的大文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人无意中将一些大的(多GB)二进制文件提交到我自己托管的gitlab存储库中,现在每次有人试图从存储库中取出服务器时,都会遇到很难。



我试图通过强制推送去除对文件的任何引用,但它似乎仍然影响服务器。有没有办法强制gitlab服务器摆脱它?



我读了一些像过滤器分支的东西,但我不知道会做什么到一个裸露的回购协议,或者我甚至会在提交时使用它,我不再提及。

更新:作为参考,这些类型的消息出现在gitlab VM的控制台:

  [5099.922896]内存不足:kill进程6200(git-upload-pack)得分1053982或者a小孩
[5099.922908]杀死进程6202(git)
[5099.930796]内存不足:杀死进程6200(git-upload-pack)得分360394或小孩
[5099.930807]杀死进程6203 (git)
[5099.938875]内存不足:杀死进程6200(git-upload-pack)得分360394或子
[5099.938886]杀死进程6203(git)
[5099.951163]内存:杀死进程6139(git-upload-pack)得分324327或子
[5099.951174]杀死进程6151(git)


解决方案

正如 OP Karl 确认在评论,运行服务器端的BFG repo cleaner (直接在裸仓库中)足以去除大的二进制文件。



如果你(如 Git - 删除Blob 中所述):

  rm -rf .git / refs / original / 
git reflog expire --expire = now --all
git gc --prune = now
git gc --aggressive --prune = now

但是( git gc --aggressive vs git repack ):

  git gc 
git repack -Ad#杀死包内垃圾
git prune#杀死厕所se垃圾

您应该得到一个更小更小的裸回购。


Someone accidentally committed some large (multi-GB) binaries to my self-hosted gitlab repository, and now every time someone tries to pull from the repository the server gets hit really hard.

I tried removing any reference to the files via force push, but it still seems to impact the server. Is there a way to force the gitlab server to get rid of it?

I read up on some stuff like filter-branch but I'm not sure what that would do to a bare repo or how I'd even use it on a commit I no longer have a reference to.

Update: For reference, these types of messages are appearing on the gitlab VM's console:

[ 5099.922896] Out of memory: kill process 6200 (git-upload-pack) score 1053982 or a child
[ 5099.922908] Killed process 6202 (git)
[ 5099.930796] Out of memory: kill process 6200 (git-upload-pack) score 360394 or a child
[ 5099.930807] Killed process 6203 (git)
[ 5099.938875] Out of memory: kill process 6200 (git-upload-pack) score 360394 or a child
[ 5099.938886] Killed process 6203 (git)
[ 5099.951163] Out of memory: kill process 6139 (git-upload-pack) score 324327 or a child
[ 5099.951174] Killed process 6151 (git)

解决方案

As the OP Karl confirms in the comments, running BFG repo cleaner on the server side (directly in the bare repo) is enough to remove the large binaries.

If you follow that with (as mentioned in "Git - Delete a Blob"):

rm -rf .git/refs/original/
git reflog expire --expire=now --all
git gc --prune=now
git gc --aggressive --prune=now

But also ("git gc --aggressive vs git repack"):

git gc
git repack -Ad      # kills in-pack garbage
git prune           # kills loose garbage

You should end up with a slimmer and smaller bare repo.

这篇关于清理git服务器上的大文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆