Please perform git gc on a remote repository as size not decreased after BFG large files removal?
Asked by Tarun:

Hi Guys,

We exceeded the allowed 4GB size of the repository, so I cleaned my local repository with BFG tool.

Size was reduced locally. git then push --force was performed. But size of remote repository has been increased by 600MB approximately.

If I understand correctly a garbage cleanup (git gc) is needed on the remote repository.

Please execute it so that we can access and work on this repository.

Thanks for your assistance.


Answers:
author: Theodora Boudale
body: Hi [@Tarun](/t5/user/viewprofilepage/user-id/5589763) and welcome to the community!

You have access to several repositories, so I'm not sure which one you'd like us to run a git gc for.

Can you please let me know the last two letters of the repo name, and the last two letters of the workspace where the repo belongs?

Kind regards,  
Theodora

comments: author: Tarun
body: [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086)Following are the last two letters of :  
Repo Name : "GC"

Workspace : "ch"


author: Theodora Boudale
body: Hi Tarun,

Thank you for the info.

I ran a git gc on the repo but its size has been reduced to only 4 GB.

Do you see a smaller size if you clone the repo locally with the -**-mirror** flag?

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

And then run **git count-objects -Hv** inside the mirror clone to check the size (fields **size** and **size-pack** in the output).

If that size is smaller than 4 GB, it is possible that the files you removed with BFG are still referenced by certain PRs, and contribute to the repository size. I cannot confirm if this is the case, as I'd need to access the repo and I can't do that without a support ticket.

I suggest creating a ticket with the support team; you can link the post you created here, the repo URL, and mention that you'd like the team to investigate if PR refs contribute to the repo size. One of my colleagues will look into it and advise next steps.

You can create a ticket 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 repo's workspace to proceed with ticket creation. The ticket will be visible only to you and Atlassian staff, so anything you post there won't be publicly visible.

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

Kind regards,  
Theodora


author: Tarun
body: [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086)

Following is the size of repo (cloned with --mirror flag) :

***4.0G***

Following is the output of "**git count-objects -Hv**" command executed on repo (cloned with --mirror flag) :

*count: 0*   
***size: 0 bytes***   
*in-pack: 115043*   
*packs: 1*   
***size-pack: 3.92 GiB***   
*prune-packable: 0*   
*garbage: 0*   
*size-garbage: 0 bytes*

It was reduced to ***2.2G***with bfg cleaner earlier.


author: Theodora Boudale
body: Hi Tarun,

Thank you for the feedback. I see that you created a ticket with the support team, and one of my colleagues is helping you with this issue.

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud