我怎样才能减少我的仓库的大小? [英] How can I reduce the size of my repository?

查看:102
本文介绍了我怎样才能减少我的仓库的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个很大的git仓库。和dotgit文件夹的大小非常大。(我们的3d建模器为350gb-ty :))我在硬盘上有240GB可用空间。当我试图运行这个命令时:

  git gc --prune = now --aggressive 

无法分配内存... lalala 

我该怎么做?我应该去git服务器并在那里运行这个命令吗?

解决方案

存储库可能会随时间推移大量大文件。砍掉你的历史并没有真正的帮助,随着更多大型文件的添加和工作,这个问题会再次出现,你将失去工作的历史。



不要直接提交大文件,请使用 Git Large File Storage(git-lfs)。这将允许您提交大文件并保留历史记录,而不会使存储库大小膨胀。



所有这些旧提交的情况如何?您可以使用 BFG Repo Cleaner 来清除您的历史记录清除历史记录中的大文件。这样可以让您保留历史记录,同时仅消除最大的违规文件。



更好 结合这两个! BFG可以将您现有的大文件提交转换为最近添加的 - convert-to-git-lfs 的小型git-lfs提交。 这篇文章都记录在这篇博文中。这是两全其美的:你保存所有的历史记录,所有的文件,并且你得到一个精简的存储库。一旦完成,对所有将来的大文件使用 git-lfs


I have big git repository. And size of dotgit folder very big.(350gb - ty for our 3d modellers :)) I have 240gb free space in hard disk. When i have tried to run this command:

git gc --prune=now --aggressive

I got some error:

can't allocate memory...lalala

What should I do with this? Should I go to the git server and run this command there?

解决方案

The repository has probably committed a lot of large files over time. Chopping off your history doesn't really help, the problem will come back as more large files get added and worked on, and you will have lost the history of your work.

Instead of committing large files directly, use Git Large File Storage (git-lfs). This will allow you to commit large files and retain history without ballooning the repository size.

What about all those old commits? Rather than just chopping off your history at an arbitrary date, use the BFG Repo Cleaner to clean large files from your history. This would allow you to retain your history while eliminating only the biggest offending files.

Even better is you can combine the two! BFG can convert your existing big file commits into small git-lfs commits with the recently added --convert-to-git-lfs. It's all documented in this blog post. This is the best of both worlds: you keep all your history, all your files, and you get a slim repository. Once that's done, use git-lfs for all future large files.

这篇关于我怎样才能减少我的仓库的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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