hello,
we are using subgit to migrate an SVN repo to a GITLab repo. We now have a massive 4gb pack file and we are now filling up the server storage too quickly. it is becoming a huge expense for us to keep upgrading the servers storage. We have found that the culprit is this pack file that GIT has created. not sure what it is or where it came from but i am hopeful that you can help us!
Hello,
the pack files are indeed being created by Git and those file contain actual data for the repository. In fact, Git uses pack files in order (among other purposes) to spare the space, so 4GB is not that much or the dat already received from SVN, loose objects would take much more space than packed. Here are a little more details on the pack files:
Git - Packfiles
So I’m afraid hardly it’s possible to reduce the space taken by the repository much if its SVN counterpart has a big size and a long history. It’s possible to get rid of the unneeded loose objects, however, so it would worth running git gc
after the initial import finished, probably, better with aggressive
option for a better result:
git gc --aggressive
Also, big pack files (their size is not limited by default) may lead to memory issues (on merge requests, for example) so it may also worth limiting the size of pack files:
git config -f <REPO>/config pack.packSizeLimit 256m
This command will set the limit for pack files to 256 megabytes so the new pack files won’t exceed this limit. It won’t affect already existing files, however, to reduce their size the repository should be repacked:
git repack -d
git prune-packed
Also, just in case, here is the git repack
reference:
Git - git-repack Documentation