Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

How can a user force a gargabe collection in bitbucket git?

In order to reduce the size of repository I did the following:

1. Created a Git LFS repository and moved all my jar files from cg-nlp-engines to the LFS repo (No problems)

2. git deleted all the jar files in the original repo and pushed it... but the bitbucket repo got bigger, so I read the how to for reducing repo size, and...

3. I cloned the original repo and used BFG to remove all the *.jar files from the history && git reflog expire --expire=now --all && git gc --prune=now --aggressive && git count-objects -vH (which showed local repo down to 611.35 Mb) && git push --all --force && git push --tags --force (No warnings or errors)

4. BUT... now my bitbucket repo says it is 4.1 GB in size and is locked.

5. Is there any way I can force a garbage collection in bitbucket?

3 answers

Repository was still not garbage collected so I

* created a new empty repo on bitbucket,

*imported my local repo into the new empty repo per instructions on

*gave the remote repo that needs gc a new name (just rename the repo on "Repository settings" page at bitbucket online)

*changed the new remote repo name to the original name of the one that needs gc

*now able to use the new properly sized repo

Will leave the old renamed remote repo that needs gc up for a while before deleting just to see how long before it gets a gc.  Will leave another message about that.

Now 4 weeks later and the oversize repository has not been garbage collected.  Will have to delete it.

Problem returned.  One developer pushed from their local repo before doing all the steps listed above and blew the repo back to even larger than it was before.  We did the steps to reduce ALL local repos to ~620MB, but the bitbucket git repo keeps growing.  It has been several days and no evidence of GC running on the bitbucket repo which is now above the 4GB limit and blocking all pushes, but a clone of the repo comes in at only 624 MB.  How often does GC run on bitbucket???  Is there any way to initiate or request a bitbucket GC????

Garbage collection ran (or was run).  All is well.

Suggest an answer

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

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,159 views 2 9
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