Repository is over the size limit (4 GB) and will not accept further additions.

sunnytecho July 12, 2022

We accidentally uploaded file of 2.5 GB which exceed limit of 4GB because our repo is already large enough ( more than 2 GB ).

To fix that issue, I tried hard reset in my local system then force pushed over git repo.

Now, I'm not able to push anything.

 

I think the only thing I have my hope on to run the garbage collector. Can you please help me?

PS: Every suggestion really appreciated by me.

Thanks in advance.

1 answer

1 accepted

1 vote
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 12, 2022

Hi @sunnytecho and welcome to the community!

I found one repo over the 4 GB limit from the ones you have access to. I ran a git gc on it and its size is 2.1 GB now.

Could you please let me know if you can see the update size now and if you are able to push?

Kind regards,
Theodora

sunnytecho July 13, 2022

Hey Theodora,
Thanks for your help. 🙏
But, unfortunately I tried to send updates and it's again turned into 4.3 GB

I do have that commit in my local system.
I removed that commit then run git gc in my local system.

Any chances do you run that command again?

Thanks in advance?

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 13, 2022

Hi @sunnytecho,

You are very welcome and of course. I ran another git gc, but I'm afraid the repo's size hasn't been reduced.

If you open the repo on Bitbucket Cloud website and check its Commits, do you see there the commit with the large file?

If so, is it the last commit on a branch?
Or have you pushed additional commits after the large one?
Has this branch (with the large commit) been merged into any other branches?

I am asking because I don't have access to your repo's content.

Kind regards,
Theodora

sunnytecho July 13, 2022

Thanks Theodora,

Unfortunately, It's not a last commit. I did add few other important changes in different commits.

 

It's also available in other branches as well on my local system which is no longer useful for me.

But, master branch is one which have this large file in local system and bitbucket server.Unfortunately, It's not a last commit. I did add few other important changes in different commits.

 

It's also available in other branches as well on my local system which is no longer useful for me.

But, master branch is one which have this large file in local system and bitbucket server.

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 15, 2022

Hi @sunnytecho,

If the commit with the large file still exists in the Bitbucket Cloud repo and if you have added more commits after that, I would suggest using BFG to rewrite history and remove the large file from the repo's history:

That link includes step-by-step instructions on how to use BFG as well as examples. If there is one large file that you want to remove, you can use BFG with the argument --delete-files (example included in the link).

A few things to note:

  • As mentioned in the link, please make sure to take a backup of the mirror clone of the repo before you use BFG, in case anything goes wrong.

  • After you use BFG, I would suggest first pushing the changes to a newly created empty Bitbucket Cloud repo, inspect it and see if it's in a good state.

  • After you use BFG, you can use the command git count-objects -Hv in the mirror clone where you executed BFG, in order to check the size of your local repo (it will be the sum of the fields size and size-pack in the output).
    When you have a repo with a size of less than 4 GB, please let me know and I can temporarily increase the repo size limit so you can push your changes to the repo you're using now, and then run another git gc on the repo.

  • BFG rewrites history, which means that the commit hashes will change. It would be good to communicate this to the other users with access to the repo so there are no surprises, and also ask them to take a new clone after you push your changes (in order to avoid pushing any of the old changes back).

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

Kind regards,
Theodora

sunnytecho July 18, 2022

Thanks Thedora for your support.

I'll check and keep you posted.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events