My repo size is not reducing after operations (2gb size limit reached)
Asked by Jonathan Marin:

Following instructions from [that link](https://support.atlassian.com/bitbucket-cloud/docs/reduce-repository-size/) and more from forums I ran a lot of things to reduce my repo size and also did revert commits from the 3 last days but nothing seems to fix the issue. I am really stuck with that and my team needs Git on our projects.   
Can you please do something for us we are desperates.  
Thanks.


Answers:
author: Theodora Boudale
body: Hi Jonathan,

I ran a git gc on this repo and its size went down to 1.4 GB, so you and your team should be able to push now.

If you have run git filter-branch and reduced the repo size by rewriting history, you can push that to the Bitbucket Cloud repo (I would suggest doing that next week, I'll explain below why). Please note that when you do that, the repo's size will go up again. Don't be alarmed, another git gc will be needed for the old references to get removed from the remote repo and for the repo's size to get further reduced.

I would suggest contacting Bitbucket Cloud support via <https://support.atlassian.com/contact/> to request a git gc for the repo after you push, as this is the fastest way to get support for such an issue. In "What can we help you with?" select "Technical issues and bugs" and then Bitbucket Cloud as product. In "What is the impact to your business?" please select Level 1, so an engineer can get to it faster. I would recommend that you push the repo with the reduced size and then open a support ticket ++next week++, as we don't have weekend support for Bitbucket Cloud.

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

Kind regards,  
Theodora


author: Jonathan Marin
body: Help from Bitbucket team wuold be appreciated. Is it the right place to ask or is there somewhere more relevant for that type of issues?


author: Jonathan Marin
body: Also ran **git filter-repo** which runs pretty well following [this link](https://docs.gitlab.com/ee/user/project/repository/reducing_the_repo_size_using_git.html). (and similar tutos from other links) result:
>
> ```
> git filter-repo --path Build/build.nss --path Assets/StreamingAssets/aa/ --invert-path
> Enumerating objects: 209737, done.
> Counting objects: 100% (209737/209737), done.
> Delta compression using up to 12 threads
> Compressing objects: 100% (53338/53338), done.
> Writing objects: 100% (209737/209737), done.
> Selecting bitmap commits: 10529, done.
> Building bitmaps: 100% (209/209), done.
> Total 209737 (delta 156269), reused 209713 (delta 156245)
>
> New history written in 16.24 seconds; now repacking/cleaning...
> Repacking your repo and cleaning out old unneeded objects
> Completely finished after 21.41 seconds.
> ```

<br />

But when trying to **git push origin --force 'refs/heads/\*'**it gives this error....

```

Enumerating objects: 2456, done.
Counting objects: 100% (2456/2456), done.
Delta compression using up to 12 threads
Compressing objects: 100% (287/287), done.
Writing objects: 100% (2456/2456), 3.00 MiB | 4.38 MiB/s, done.
Total 2456 (delta 2163), reused 2456 (delta 2163)
remote: Resolving deltas: 100% (2163/2163), completed with 1135 local objects.
remote: Repository is over the size limit (2 GB) and will not accept further additions.
remote:
remote: Learn how to reduce your repository size: https://confluence.atlassian.com/x/xgMvEw.
To bitbucket.org:smarttale/my-baby.git
! [remote rejected] TRCPS4 -> TRCPS4 (pre-receive hook declined)
! [remote rejected] Tst_merge -> Tst_merge (pre-receive hook declined)
error: failed to push some refs to 'git@bitbucket.org:smarttale/my-baby.git'
```

<br />

and tried git gc but nothing seems to work at the end on server side.  
Actually running ***git count-objects -Hv*** gives us:

```
count: 0
size: 0 bytes
in-pack: 209737
packs: 1
size-pack: 113.10 MiB
prune-packable: 0
garbage: 0
size-garbage: 0 bytes
```


Tags: bitbucket-cloud

cloud