Reputation: 880
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?
Upvotes: 4
Views: 355
Reputation: 164629
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.
Upvotes: 2