Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Repository size not updating after clean up

daniel_cheng June 18, 2025

Hi ,

 

I recently performed a cleanup on one of our repositories, but the repository size displayed in Bitbucket has not updated accordingly.

 

Below are the commands I executed:

git reflog expire --expire=now --all
git gc --prune=now --aggressive
git push origin --force --all
git push origin --force --tags

 

When I run "git count-objects -vH" locally, I can see that the repository size has been reduced.

Could you please advise whether there's a delay in size recalculation on Bitbucket's side, or if any additional steps are required on my end?

Thank you.

2 answers

0 votes
Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 18, 2025

Hi @daniel_cheng 

I have attempted to reduce the size of your largest repositories by executing a garbage collection, but it has not reduced the size. This is because you have large binary files that are being retained in metadata storage (pull requests), and these are not present in a local clone. Unfortunately - metadata cannot be targeted with garbage collection operations and this is why we cannot reduce the size on our end.

To resolve this:

  1. Perform a clone of those repositories for backup purposes

  2. Delete those repositories from your workspace to free up space and allow you to push. NOTE: This will permanently remove metadata such as PR's/pipelines/user permissions etc.

  3. Identify the largest files in your repositories by executing the following command:
    git rev-list --objects --all \
    | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' \| awk '/^blob/ {print substr($0,6)}' \
    | sort -r --numeric-sort --key=2 \
    | numfmt --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest

  4. Perform cleanup operations locally to reduce the size

  5. Once complete, push those repositories back to your workspace by creating a blank repository with the same name of the deleted repository, then mirror pushing the contents of the cleaned repository: 

HTTPS
git push --mirror https://<username>@bitbucket.org/<WorkspaceID>/<RepoName>.git
SSH
git push --mirror git@bitbucket.org:<WorkspaceID>/<RepoName>.git

NOTE: This will remove metadata such as PR's/pipelines/permissions etc but will keep your commit history and binary files intact.

Please let me know if you need assistance with this.

Cheers!

- Ben (Bitbucket Cloud Support)

daniel_cheng June 20, 2025

Hi @Ben , thank you so much for your explanation and the detailed steps to resolve the issue. I will try it out.

0 votes
Ignacio Ampuero June 18, 2025

Hey!

If you’ve done some cleanup (like history edits, rebases, squashes, or other history modifications) and pushed it, then the remote repo should now be as clean as the local one.

Unfortunately, the reflog and gc commands are local operations and aren’t transferred when pushing to a remote. Bitbucket has its own garbage collection system, which runs periodically or based on repository size.

So, one option is to wait for an Atlassian team member here on the forums to notice the issue and trigger a GC on your repo—or simply wait it out.

This has been a recurring issue on Bitbucket and has been resolved by the Atlassian team in the past.

Hope that clear things up!

daniel_cheng June 20, 2025

Hi @Ignacio Ampuero thanks for the advice, this really helps me understand the process.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events