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.19
but 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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
git ls-tree -r --long HEAD | sort -k 4 -n -r | less
this commands list all files with ascending order to there file size and there is 4 files above 20 MB in this list
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Theodora Boudale removed all the branches
deleted all commit history using the below set of instructions
git checkout --orphan last
git add -A git commit -am "fresh init"
git branch -D dev
git branch -m dev
git push -f origin dev
but still repo size has increased
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I can run a git gc for the repo, this may help reduce its size.
Which is the repo where you pushed these changes? Is it the one named v*****ces or the one named v****ces-fork?
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I ran a git gc, but the repo's size remains is still 2.2 GB.
I would like to ask if you could check the following:
Take a mirror clone of the repo with the command
git clone --mirror <repo_url>
Then, navigate to the directory of the mirror clone and run
git count-objects -Hv
What is the output that you see?
If the sum of the fields size and size-pack in the output is less than 2.2 GB, then it is possible that some of the old references are still part of certain PRs in the repo.
Please let me know what output you see and I can then inform my colleague who is handling your support ticket to investigate.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Theodora Boudale ok I will check that
secondly the repo size in the bitbucket page is showing 2.15 which initially was when I started to solve the issue
but I want to let you now that
all branches have been deleted except dev which is forcibly pushed by creating an orphan branch to remove or clean all previous commit history hence no PRS exists on repo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for the info, @Ahmad Kabeer Shaukat.
Even if you deleted all branches, some refs may still exist in older PRs of the repo.
I have informed my colleague who is handling your support ticket that the size of the mirror clone is smaller, and he is going to check if it is PR refs that take up so much space.
You will receive an update from my colleague in the support ticket you created.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Theodora Boudale creating and deleting a branch will automatically run GC behind the scenes
am I correct ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Every push to a repo will trigger a git gc but with different options and arguments depending on several conditions.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.