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

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.


Answers:
author: Theodora Boudale
body: Hi [@sunnytecho](/t5/user/viewprofilepage/user-id/4985018) 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

comments: author: sunnytecho
body: 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?


author: Theodora Boudale
body: Hi [@sunnytecho](/t5/user/viewprofilepage/user-id/4985018),

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


author: sunnytecho
body: 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.


author: Theodora Boudale
body: Hi [@sunnytecho](/t5/user/viewprofilepage/user-id/4985018),

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:

* <https://rtyley.github.io/bfg-repo-cleaner/>

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


author: sunnytecho
body: Thanks Thedora for your support.

I'll check and keep you posted.


Tags: atl-rvw

bitbucket-cloud

cloud