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

My repository size is 4.1 GB even though I've cleared it to the initial commit. Manual git gc doesn't seem to work. I saw one person posting a question to the community and ATLASSIAN TEAM member gave a hand on this. Can someone check into my rep the same way?


Answers:
author: Theodora Boudale
body: Hi [@?????? ????????](/t5/user/viewprofilepage/user-id/4859087) and welcome to the community.

I ran a git gc for the repo that was over the 4 GB limit, its size is 79.0 KB now.

Does this agree with the size of your local repo, if you run **git count-objects -Hv**?

Kind regards,  
Theodora

comments: author: ?????? ????????
body: Many thanks to you for such a hasty response!   
But as I see it, such situations may happen again and again.   
I'm trying to look now for the options how to fix that.  
As I see, the majority of the weight of the project was in the .git .pack file.  
I understand that it might not be your sphere of knowledge since you are on ATLASSIAN TEAM, not GIT, but you may have encountered it already?  
Along with all the information available online, what can you say is the problem there?  
Numorous and heavy-weighing commits, some files that should have been put into .gitingore file, or something more?  
And also, can I run git gc somehow on the server side, not to disturb you and your team members? Because as I understand it, launching this command locally wont help much if I cant push the result to BITBUCKET (4GB restriction)


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

You are very welcome, I'm glad to have helped.

The git pack file is the file where files and the history of the repository are saved. If this is large in size, it is possible the repo has some large/binary objects, or it could also be due to a very large history. It's hard to say without examining the repo.

You can check my reply to another user's question here:

<https://community.atlassian.com/t5/Bitbucket-questions/Revert-bitbucket-repository-state-to-one-day-prior/qaq-p/1908360#M76762>

I share details on how to identify any large files in the repo and also the two options of 1) removing such large files from the repo's history 2) alternatively, track these files with Git LFS if they need to be versioned

If certain large files don't need to be versioned and you remove them from the repo's history, it may be best to add them in .gitingore afterwards, so they don't get committed to the repo again.

At the moment, I'm afraid it is not possible for users to trigger a git gc on their remote repos. We have a feature request about this in our issue tracker:

* <https://jira.atlassian.com/browse/BCLOUD-11593>

I would suggest adding your vote to the feature request, and you can also add yourself as a watcher if you'd like to get notified via email on updates.

The automated git gc will run in the following case at the moment:

* The repo is over the 4 GB limit because of a large push
* You enable the Labs feature **Delete dangling commits when over size limit** from <https://bitbucket.org/account/settings/features/>
* You undo the large push with a git reset to the branch before the problematic commit, and you push that

If all 3 conditions apply, then an automated git gc should get triggered. This is also mentioned in our docs here:

* <https://support.atlassian.com/bitbucket-cloud/docs/reduce-repository-size/#Undoing-the-last-push>

Please feel free to let me know if you have any questions.

Kind regards,  
Theodora


Tags: atl-rvw

bitbucket-cloud

cloud