Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Encountering Repository Over Size Limit Issue Despite Successful Local Cleanup - Need Assistance

I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 19, 2023


Hello Bitbucket Community,

I am encountering a persistent issue with my repository identified as exceeding the 4GB size limit, despite local cleanup operations. After using BFG Repo-Cleaner and Git's garbage collection on my local system, my repository size has been significantly reduced. However, when attempting to force push these changes to Bitbucket, the push is declined due to the repository still being over the size limit.

My repository's URL is:<redacted>/<redacted>.git .

The exact commands I have used are as follows:

  1. Cloned a bare mirror of the repository: git clone --mirror<redacted>/<redacted>.git
  2. Used BFG to remove *.apk files: java -jar /path/to/bfg.jar --delete-files *.apk
  3. Cleaned up and compacted the repository with Git: git reflog expire --expire=now --all && git gc --prune=now --aggressive
  4. Attempted to force push the changes back to Bitbucket: git push --force

The error message I receive when trying to push is as follows: 

 remote: Repository is over the size limit (4 GB) and will not accept further additions.
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to '<redacted>/<redacted>.git'

Given that my local repository size is well below 4GB following the cleanup, I believe there might be a discrepancy in how Bitbucket is calculating the repository's size. Any help on how to rectify this would be greatly appreciated. Thank you in advance for your assistance!

1 answer

1 accepted

0 votes
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 20, 2023

Hello @Guy and welcome to the Community!

After pushing the cleaned-up repository to Bitbucket, the removed objects become dangling in the repository and a git garbage collection (GC) needs to be executed in the remote repository to remove those objects that are still occupying space.

I went ahead and triggered a GC on the repository you shared, and the size went down to 772MB!

Now that GC is completed, I would highly recommend you having everyone on your team removing their old copies of the repository and doing a fresh clone of it. Since the old clones have a dirty history, it's better to delete them, so you don't risk pushing the dangling objects back into your cleaned repository, which would increase its size again.

Note: I've removed the repository and workspace name from your question to protect your privacy.

Thank you, @Guy !

Patrik S

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events