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

Cannot reduce repository size after exceeding 2GB limit



I have exceeded the 2GB limit on my bitbucket repo and have followed the directions provided to try to reduce it.  All has been unsuccessful as the repo is not reduced in size.  Note that:

(1) I have the Labs garbage collection feature turned-on.

(2) I tried the following to clear-out the repo history:

  1. rm -rf .git
  2. git init
  3. git add .
  4. git commit -m “Removed history”
  5. git remote add origin <repo_url_removed>
  6. git push -u –force origin master

(3) When I check the size of the repo remotely, I see that it is not over 2GB:

git count-objects -Hv
count: 8
size: 164.00 KiB
in-pack: 482
packs: 1
size-pack: 16.41 MiB
prune-packable: 0
garbage: 0
size-garbage: 0 bytes


I have had this problem before, and the solution was for a sysadmin to run a garbage collection on the repo.  Perhaps this is what needs to be done this time.  Thank you for your assistance.

-- Jeff


1 answer

1 accepted

1 vote
Answer accepted

Hi Jeff and welcome to the community!

I ran a git gc on the repo and its size is 22.8 MB now.

Regarding the Labs feature and why it didn't work:

(1) At the moment we don't enforce the 2 GB limit on repos owned by workspaces on the Free plan (see here).
This means that all repos have a 4 GB limit at this time, so the Labs feature will work if a repo goes over 4 GB.

(2) If a repo is over the limit and the Labs feature is enabled, you'll need to undo the last commit with a git reset and push that, you can see more details here.

Just a heads up, I removed the repo URL from your post to protect your privacy.

Please feel free to let me know if things are ok now and if you need anything further!

Kind regards,

Thank you Theodora. I still don't understand why my attempts to garbage collect failed, though.  I did the following several times:

git gc --aggressive --prune=all

...with no success.

-- Jeff

Hi Jeff,

You are very welcome.

If you run a git gc locally in a clone of your repo, the cleanup runs in that clone on your machine. It doesn't run in the Bitbucket repo which is hosted on our servers.

I hope this helps to clarify things, please feel free to let me know if you have any other questions.

Kind regards,

ok.  I ran the git gc locally on the master.  Would be nice if there was a way to clean-up one's repo without having to ask for sysadmin-level help.

-- Jeff

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,223 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