How to reduce git repo size on Bitbucket?
I've found that the easiest way to reduce the Bitbucket repo size if you are over the 2GB limit is to
- Create a branch on Bitbucket
- Delete that branch on Bitbucket
This should trigger Bitbucket to run git gc
on the repo.
After conferring with Bitbucket technical support, I can now answer some of my own questions:
- Why did moving 450MB of files out of the repo only reduce the size of my local repo by 90MB? Something in the history got missed. I don't what exactly, but the filter-branch command missed something. I was able to successfully reduce the repo size by 450MB by running the utility BFG Repo-Cleaner.
- Why did even that modest reduction not get pushed to the remote repo on Bitbucket? It did, but Bitbucket support must then run git gc on their side. One can contact Bitbucket request and ask them to run git gc on a repo.
- How on Earth did the remote repo size jump from 973MB to 2.3GB? Unknown. Bitbucket technical support didn't have the answer to this one either.
- How do I fix it? Contact Bitbucket support. They can put a repository back into read-write mode so that you can push a smaller repository and they can run git gc on their end.