I have applied several methods based on documentation in the URL provided by bitbucket as a repo size warning message I tried below To be safe I forked the repo to my account and applied the below code so that i could see the solution works or not but to no avail even this solution increased by repo size to 2.19but could not find any git clone git@bitbucket.org:workspace-id/repo.git cd crepo/ git checkout dev && git pull git gc java -jar ../bfg-1.14.0.jar --strip-blobs-bigger-than 20M git reflog expire --expire=now --all && git gc --prune=now --aggressive
Welcome to the community @Ahmad Kabeer Shaukat !
I hope this page resolves your issue: https://support.atlassian.com/bitbucket-cloud/docs/reduce-repository-size/
i tried everything on this page i created a temp repo and pushed all my actual repo content and it shows a size of 7.9 MB however even after deleting all my tags and a lot of branches I was unable to reduce my git repo size
git ls-tree -r --long HEAD | sort -k 4 -n -r | lessthis commands list all files with ascending order to there file size and there is 4 files above 20 MB in this list
@Nikola Perisic
Hi @Ahmad Kabeer Shaukat,
If you rewrite history and push to the remote, its size will increase because the remote repo will have both old references (before history rewrite) and new ones (after history rewrite). A git gc is needed on the remote repo to remove any old references. While end users can run a git gc on their local repo, they can't trigger a git gc on the remote repo.
I see that you have deleted the fork you created. Please let me know when you push the BFG changes to the repo it was forked from, and I can run a git gc for it.
Just a heads up, I removed the workspace id and repo name from your post to protect your privacy.
Kind regards,Theodora
@Theodora Boudale Thanks for your kind response.Is there anything that can be done from your side because I failed to reduce the repo size either it could be guidance or some direct help the goal is to reduce repo size we want to remove all history except for the last month
After you push your changes with BFG to a Bitbucket repo, we need to run a git gc on this repo from our side for the change in size to be reflected.
I have the following suggestions:
1. I see that you are running the BFG in a regular clone of the repo. Please run it on a mirror clone as per the instructions on the BFG page https://rtyley.github.io/bfg-repo-cleaner/
You can take a mirror clone with
git clone --mirror git@bitbucket.org:workspace-id/repo.git
2. After you follow the steps on the mirror clone, create an empty Bitbucket Cloud repo (no .gitignore, no README). Push to this empty repo, and then inspect the size and if the repo is in good shape.
If it is, then push to the repo your team normally uses.
3. Afterwards, please post a message here so I can run a git gc on the repo (not the new one, the one your team normally uses)
@Theodora Boudale available for guidance?
It looks like you're new here. Sign in or register to get started.