Large repo size
Asked by Viktor Minkovski:

Hi all,

One of our repos got too big 2.3 GB. The issue is the usual one with big files in the history.

After several attempts to use the proposed tool Bfg, the size is now up to 3.8 GB and nearing the limit.

On the other hand, when cloned locally, the size of the remote repo is 1.3, which while still big, is at least acceptable.

Can someone share some hints on how is the difference between remove and local clone possible? Is there anything else I need to do? The usual git gc does not seem to help.

Thanks in advance for the support.


Answers:
author: Theodora Boudale
body: Hi Viktor!

If you rewrite history and push it to Bitbucket, the repo's size will go up because the repo will contain both new commits and old ones (before the history rewrite). A garbage collection is needed on the Bitbucket Cloud repo to remove the old references and for the repo's size to get reduced. This runs on every push but with different arguments depending on several different conditions, so the dangling commits may not get removed immediately.

I can run a git gc for your repo that should remove these dangling commits. Can you let me know the first two letters of the repo name (or any other combination of letters that will help me identify it)? I checked the repos your account has access to and I do not see one with a size of 3.8 GB.

Kind regards,  
Theodora

comments: author: Viktor Minkovski
body: Hi Theodora,

Thank you very much for your answer. The repo name (the whole one) is \<repo_name\>, under the \<workspace_name\> project. Thank you very much for your cooperation.

Kind regards,

Viktor


author: Theodora Boudale
body: Hi Viktor,

Thank you for the details. Just a heads up, I removed the repo and workspace name from your post to protect your privacy.

I ran a git gc for the repo and its size now is 2.2 GB.

You mentioned a size of 1.3 GB when cloning locally. I was wondering if you could check that for a mirror clone as well, to understand if the size difference is due to branches missing from your local clone (a regular clone will only pull the repo's main branch) or due to certain refs not being removed from the Bitbucket repo.

You can do a mirror clone with the command

```
git clone --mirror repo_url_here
```

and then navigate to the directory of that mirror clone locally, and run

```
git count-objects -Hv
```

What output do you get from this last command?

Kind regards,  
Theodora


author: Viktor Minkovski
body: Hi Theodora,

Below is the output of the count, done on a mirrored clone :

```
$ git count-objects -Hv
count: 0
size: 0 bytes
in-pack: 51484
packs: 1
size-pack: 1.00 GiB
prune-packable: 0
garbage: 0
size-garbage: 0 bytes
```


author: Theodora Boudale
body: Hi Viktor,

Thank you for the output.

We would need to check the repo refs to see which refs contribute to this size on Bitbucket's side and how they can be removed, and I cannot do that without a support ticket (we need a support ticket to access a repo).

You can create a ticket with the support team via <https://support.atlassian.com/contact/#/>, in "What can we help you with?" select "Technical issues and bugs" and then Bitbucket Cloud as product.

When you are asked to provide the workspace URL, please make sure you enter the URL of the workspace that is on a paid billing plan to proceed with ticket creation.

Please also mention in the ticket description:

* the repo URL
* that a git gc was triggered on the remote repo, but the size still doesn't match the size of your mirror clone

The support ticket will be visible to you and Atlassian staff only, so any info you post there won't be publicly visible.

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

Kind regards,  
Theodora


author: Viktor Minkovski
body: The support ticket is created(BBS-2130430).

Thanks again for the support.

Kind regards,

Viktor


author: Theodora Boudale
body: You are very welcome, Viktor. One of my colleagues is going to reach out via the support ticket.

Have a nice day,  
Theodora


Tags: bitbucket-cloud

cloud