Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Repository size exceeds limit - not allowing to push new changes

magento.extention September 17, 2023

Currently we are facing bitbucket repository size issue and facing below error while push the code.
Error: remote: Repository is over the size limit (4 GB) and will not accept further additions.

 

Would you please do needful to reduce the repository size so we can upload the code in bitbucket repository?

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 18, 2023

Hi @magento.extention,

I can run a git gc for your repo, this may help reduce its size.

Your Bitbucket Cloud account has access to a large number of workspaces and repositories. Could you please let me know the last two letters of the repo name and the last two letters of the workspace ID this repo belongs to? I can then identify it from the ones you have access to, and run the git gc.

Kind regards,
Theodora

magento.extention September 18, 2023

Hello @Theodora Boudale 

Thank you for the quick response. Yes, would you please run git gc command? 
Please find the last two letters of "workspace: on" & "repo: od" . 

Before you run "git gc" command would you please let me know that is is possible to remove specific commit id completely from git history and its log? 

Actually, by mistake, we have pushed one large commit which may be around 2.5 GB size which contains some backup files & some development files.
In the next commit we have removed only backup files which is not usefull and its commit size also may be around 2.5 GB.
If it's possible to remove that specific commit with its history which is no longer usefull for us then repo size might be automatically decrease.

Your suggestions are highly appreciated

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 18, 2023

Hi @magento.extention,

If these two large commits are the last ones on the branch (you haven't added any more commits after those) and if you haven't merged this branch with any other branch, you can rewind history and undo these last two commits. You can find steps here:

When the repo is over the 4GB limit because of a large commit, the only thing you can push is a git reset that undoes this large commit or commits.


If the large commits are not the last ones on the branch, or if you have merged the branch to other branches, I would suggest rewriting history with a tool like BFG to remove the large files/folders from history:

If you rewrite history with BFG, you can check locally the size of the local repo where you ran it, with the command

git count-objects -Hv

to confirm if the size has reduced. You won't be able to push to your Bitbucket repo though. If you use BFG and you get a smaller repo, you can let me know and I can temporarily increase the repo size so you can push, and I can run a git gc that will be needed.

 

Please feel free to let me know what option is best for you depending on where these commits are in history and how you would like to proceed.

Kind regards,
Theodora

magento.extention September 18, 2023

Hello @Theodora Boudale 

As i have mentioned in above comment there are 2 commits wich object side is showing morethan  2.5GB. And after that commits I have also merged other 3-4 commits as well.


I am afraid if I follow the commands mentions in https://rtyley.github.io/bfg-repo-cleaner/ then in one commit my other development useful files are there. Will those files also removed from the server? Or it will be removed only from the history? 

 

I have mirror/clone bitbucket repo in my local and checked the object folder showing only 3 packs 1 with 5.4GB size and the other 2 are less than 10MB size. 

 

Or other best option is to run "git gc" without doing/running any commands to remove that unwanted 1 large commit?

 

Please advice. 

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 18, 2023

Hi @magento.extention,

Running a git gc without doing anything else is most likely not going to reduce the repo's size much since the commits with large files are part of the history. The git gc clears dangling commits that are not referenced by any branch.

BFG offers the options (mentioned on the link)

--delete-folders

and

--delete-files

If you use BFG with any of these arguments and you specify a folder or certain files, then BFG will remove from history only this specific folder or files. It will not remove any files or folders you did not specify.


After you use BFG, you can first push to a newly created empty Bitbucket repo that you create for testing purposes. You can then inspect this test repo, to see if the source code is the way you expect it to be. If that repo looks ok, you can then push to the actual repo you are working on.

Kind regards,
Theodora

magento.extention October 3, 2023

Hello, @Theodora Boudale Thank you for sharing the details. Lets try to use BFG and try to reduce the  repo size. 

Once again thank you for your suggestion. 

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 3, 2023

Hi @magento.extention,

You are very welcome.

If you follow my advice and first push to a newly created repo, you see it looks ok, and you then want to push to the existing repo that is over the 4GB limit, please let me know.

Since the repo's size is over 4GB, you won't be able to push your changes there. I can either run a git gc for the existing repo (in case it helps bring down the repo size) or temporarily increase the repo size limit so you can push the changes you make with BFG.

Kind regards,
Theodora

magento.extention October 4, 2023

Hello @Theodora Boudale 
Thank you for the comment. As of now we have created new repo and uploaded code over there. We will let you know in the future if need any help. 

Thank you :)

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 4, 2023

Hi @magento.extention,

Sure, please feel free to reach out if you need help in the future!

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events