This repository reached the 2 GB limit, restricting it to read-only access.


I recently got the following warning on

This repository reached the 2 GB limit, restricting it to read-only access.

I then followed the instruction given here to reduce my repository size and restore write access.

I ran the following commands in my corresponding local git repo (which was up-to-date with this one) and ran:

git reset --hard <commit-SHA>

git push --force origin master

But still got error.

2 answers

0 votes

Hi Igor, according to what you said in your message, looks like you were not following the steps exactly as we mention in our documentation. Keep in mind that you need to reset back as many commits as necessary to bring the repo under 2 GB. The way to go here would be:

  1. Obtain a fresh clone of the repo from Bitbucket (always advisable in case something goes wrong).
  2. Do a git reset, as many commits back as needed to make the repo's size go below 2 GB.
    • git reset --hard <some_revision> 
  3. Force push 
    • git push --force

Make sure you have a local backup before try the command above.

Once you pushe the reduced repo to Bitbucket it will remove the read-only limit.  Let us know if you need further assistance! 

Best regards,


Hi, Ana,

I do next steps, but got same message:

1)   :~/$ git log -n 4
commit b3d59340f42c146cf3a1c08e4c37e610b9ca79c2 (HEAD -> master, origin/master, origin/HEAD)
Author: Igor <>
Date:   Tue Dec 12 18:20:34 2017 +0200

    - comment eps
    - thumbnail add onclick action

commit d3294b8e4adf1353f2468f4e4f06d0b342acd13e
Merge: def40b3 8df24e4
Author: Igor <>
Date:   Mon Dec 11 21:54:03 2017 +0200

    Merge remote-tracking branch 'origin/master'

commit 8df24e449849b6fe53f5227c8660502f26a9de59
Author: Vasilij Zakharov <>
Date:   Mon Dec 11 12:24:01 2017 +0200

    EPS processing fix

commit 2a4d5aaa7ed4574c3fdde1b2e8036c534152c814
Author: Vasilij Zakharov <>
Date:   Mon Dec 11 10:22:03 2017 +0200


2):~/$ git reset --hard 8df24e449849b6fe53f5227c8660502f26a9de59
HEAD is now at 8df24e4 EPS processing fix

3):~/$ git push --force
repository is in read only mode (over 2 GB size limit).

Learn how to reduce your repository size:
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Can you delete in repo on server directory  storage/4upload ?


Best regards,


I've run a garbage collection in the remote repository and it went down from 6+GB to 2.1GB. It's still over the limit, but this means that what you're doing is working, you just need to reset back to a previous commit so the repo is back to under 2GB.

Have you tried deleting the repo yourself? You could delete it and then upload the new reduced version. If you can't, let me know (and also confirm you have a copy of it) so I can continue helping you.



@Igor Gorovoy

I inherited a repository recently that had many unnecessary large binary files committed in the history which caused the repository to be many GB.

The solution I used was to download

Obviously make a local backup copy first.

Open the repository in Git Extensions. Then under the Plugins menu, select 'Find Large Files'.

Check any very large offenders and hit confirm.

You can check the new size by looking at the folder size for the local copy you are working on. Note the history will be re-written and these objects will be gone forever! Needless to say, don't delete anything you will need in the future.

To finalize the changes, do a force push to the origin.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Thursday in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder :  #!/bin/bash source "$(dirname "$0")/" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables ROLLBAR_ACCESS_TOKEN...

215 views 0 12
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you