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

  1. Create a branch on Bitbucket
  2. 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:

  1. 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.
  2. 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.
  3. 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.
  4. 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.