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

Repo size exceeds 4GB, cant push fixes


It looks like I am facing the same issue.
My git repo was 3.3Go.

I used bfg to remove one large file
then use git reflog and git gc
then push -f to rewrite history

It worked for develop branch, but now I can't do the same things for master branch because the size is now 4.04Go so my push is rejected.

I used git count-objects obtaining:

count: 0
size: 0 octet
in-pack: 7360
packs: 1
size-pack: 789.02 Mio
prune-packable: 0
garbage: 0
size-garbage: 0 octet

@kelkk I tried a solution with an other git repo.
After using bfg, git reflog and git gc, i create an other git repo and use on my initial local repo:

git remote set-url origin

git push -f --all origin

it worked, but I don't want to redo all my git settings, variables, etc...

1 answer

1 accepted

1 vote
Answer accepted

Hi @Nicolas Eche,

I checked the repositories that your Bitbucket Cloud account has access to and I found one over the 4 GB limit. I ran a git gc on it and its size is 795.5 MB now.

When you rewrite history and push your changes, the remote repo's size will go up because it will contain both old and new references. A git gc is needed on the remote repo for the olds refs to get removed and for the repo's size to get reduced.

If you need to remove files from the history of all branches, I would recommend running BFG on a mirror clone (as mentioned here:, this way you will not have to repeat the process for every branch.

If you plan to use BFG again to reduce the repo's size further, please feel free to let me know after you push your changes and I can run another git gc. Alternatively, you can also create a ticket with the support team and ask them to do so, since the repo is owned by a workspace on a paid billing plan. You can create a ticket via, in "What can we help you with" select "Technical issues and bugs" and then Bitbucket Cloud as product. In "What is the impact to your business?" please make sure to select Level 1 if the repo is over the size limit and you are blocked from working.

We have a feature request to allow users to initiate a git gc for remote repositories:

You can add yourself as a watcher in that feature request by selecting the Start watching this issue link if you'd like to get notified on updates.

Just a heads up, I moved your post to a new question. It's best to create a new question for your issue instead of replying to an existing question, as this way your new question will be visible to my colleagues as well when I'm out of office (and you'll get help faster if I'm out of office for a long time).

If you have any questions, please feel free to let me know.

Kind regards,

Hi @Theodora Boudale,

Thanks for your quick answer last week it really helped me.
I've started watching the issue, hoping we will be able to use it soon.

I've finished my bfg cleanings so if it is possible to re-run git gc it will be perfect.

Thanks again,
Best regards,

Hi Nicolas,

You are very welcome!

I can of course run another git gc; would you mind sharing the last two letters of the repo's name or the repo's size in Bitbucket Cloud, so I can identify which one it is and run the git gc?

Last week I could identify it based on the repo size you mentioned, but I cannot recall now which one it is.

Please keep in mind also that the repo will go in read-only mode while the git gc is running, to avoid any corruption.

Kind regards,

Like Nicolas Eche likes this

The last two letters of the repo are 'ro'

Thank you Nicolas, I ran a git gc on the repo and its size is 46.0 MB.

Does this agree with the size of your local repo? Please feel free to let me know if you need anything further.

Kind regards,

Like Nicolas Eche likes this

Thanks a lot,
It agree with the size of my local repo.

Kind regards,

That's good to hear and you are very welcome.

Please feel free to reach out if you ever need anything else!

Kind regards,

Like Nicolas Eche likes this

Suggest an answer

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

📣 Calling Bitbucket Data Center customers to participate in research

Hi everyone, Are you Bitbucket DC customer? If so, we'd love to talk to you! Our team wants to dive deep to understand your long-term plans regarding Bitbucket DC and Atlassian Cloud. Do you plan...

234 views 2 5
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