1

I'm trying to solve a repository size limit issue on a repository hosted on Bitbucket, where I have reached the 2GB repository size and can no longer push new commits into.

At one point in time, this repository became very big due to the nature of the files in it (Many textures and sound files that were needed as part of the Unity project this repo is for), and our solution at the time was to create a submodule to place all assets into while keeping the core project in the main repo.

This worked for a while, but now I have reached the limit again on the main repo, and digging into it (Thanks to the script provided in this answer: How to find out which files take up the most space in git repo?), I found out that the reason for this was that all of the files that we have moved to the submodule still have their history intact in the main repo.

I then found out about The BFG (https://rtyley.github.io/bfg-repo-cleaner/) that I could use to rewrite the history of my repo and remove the large entries in it by using bfg --delete-folders, then running git gc as instructed in the Usage segment of The BFG page.

Running git count-objects -v afterwards seems to suggest that this had worked, with my repo dropping from a 1.9gb size-pack to under 300mb. And running the script linked above that finds the heaviest entries in the repo no longer finds any of the problem files that were moved to the submodule.

My problem is that despite all that, when I try to push the cleaned repo back to Bitbucket, it fails under the same claim that the repo had exceeded the 2GB size limit and can no longer accept any pushes. If it can't accept the push that's supposed to clean it up, then how exactly am I expected to do that? Any ideas what I'm missing?

Thanks

2 Answers2

1

You might delete all its branches on github and then push the new branches.... or you might delete the repo as a whole on github, recreate it from scratch and push the new branches.

eftshift0
  • 26,375
  • 3
  • 36
  • 60
  • Is it even possible to create a new repo from the cleaned version? As I understand the process that I did, I cloned the repo with the mirror flag, making it a bare clone, meaning that it only contains the tree info and not any of the actual files, correct? That would mean that I need to pull into it so I can have the actual physical files before I can try creating a new repo out of it, but if I pull then it'll get dirtied again, wouldn't it? – Mor Zilberman Jan 05 '20 at 13:19
  • I ended up cloning out of the cleaned bare local repo, and pushing that into a new bitbucket repo. – Mor Zilberman Jan 05 '20 at 22:21
  • Further adding to this that I later got a response from bitbucket support saying that they could temporarily increase the size limit so I'm able to push the commit through to reduce the size of the repo. Just a heads up for anyone else who runs into this. – Mor Zilberman Jan 06 '20 at 18:15
0

Bitbucket's approach to size limits appears to be to lock the repository against all changes when it goes over the limit. "All changes" means exactly that. You not only cannot add to the repository, you also cannot replace the repository with a smaller one.

This is a Bitbucket feature and has nothing to do with Git. You must contact Bitbucket support.

torek
  • 448,244
  • 59
  • 642
  • 775