Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Need git gc on remote

We hit 2GB in our repository. How can we run git gc in remote as we cannot push anything.

1 answer

1 vote

Hi Cris, Git GC is currently run Internally on a secured server by experts on the Bitbucket end. I would suggest to follow the below steps and see if this helps. 

I would suggest you use the BFG tool in order to remove large files from the repository’s history. As per our Reduce repository size documentation https://confluence.atlassian.com/bitbucket/reduce-repository-size-321848262.html you can use BFG such as $ java -jar bfg.jar --strip-blobs-bigger-than 50M to remove all file bigger than 50M. You can customize the size of the files you want to remove according to your needs. Please refer BFG Repo-Cleaner by rtyley for the link https://rtyley.github.io/bfg-repo-cleaner/ to download the BFG jar and for more information on how to run BFG.

----------------------------------------
Here are the brief steps
----------------------------------------
git clone --mirror git://example.com/some-big-repo.git
java -jar bfg.jar --strip-blobs-bigger-than 50M some-big-repo.git
cd some-big-repo.git
git reflog expire --expire=now --all && git gc --prune=now --aggressive
git push
----------------------------------------

Post running this step, please reach out to Bitbucket support to run the Garbage Collection at the backend which will help reduce the size immediately. 

Additionally, for future GC process, you can enable the below method:
-----------------------------------------
Beta Feature - Self Serve for Customers:
-----------------------------------------
You can enable an experimental feature to trigger GC automatically next time you accidentally push a large commit and go over the 2GB size limit.

Do this by clicking on your profile icon and selecting Bitbucket Labs, then enabling the feature "Delete dangling commits when oversize limit". This only affects your personal login; tell your team in case they want to try it out too.

Next time you accidentally push large files to Bitbucket, follow the user guide to reset the branch just before the large commit. When you force push that refs-only change, the Labs feature will automatically run GC to immediately remove the large commit. It may take several minutes for the GC to run and the size to update.

This should bring your Bitbucket repo below the size limit, allowing you to push commits again without having to raise a support request. Anyone else using the same repo who has pulled the large commit will need to create a fresh clone.

Note that this won't work if your repo goes over 5GB. In that case your repo is put into read-only mode and you will need to request help from the support team.
-----------------------------------------

thank you this is great!

your welcome Cris, request you to please accept the answer if you feel this is what you were looking for.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

1,804 views 0 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you