Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail and return the following error: remote: fatal: pack exceeds maximum allowed size.

Why are we implementing a max size push limit?

Bitbucket currently has a hard limit of 4 GB per repository, so to help prevent users from going over the limit and blocking their repository the Bitbucket team is introducing a max push size limit of 3.5 GB. This should help prevent users from accidentally pushing larger files and putting the repository into a read-only state.

What does a push limit mean? 

With Git, when you push your files and history, a pack file is generated which is a binary file that is created to store your history along with file contents. This file can become large, especially if you place things like large binary objects, such as Docker images, videos, or large photos. Even though Git does compression on these push files, they can still become very large and unmanageable.

What can I do if I run into this error?

We have a friendly guide to help you reduce the size of your repository, along with guidance on how to avoid pushing large commits.

Below are the two methods you can use to address the error mentioned above:

Method 1:

You can divide the whole project into some smaller commits and push several times to upload the whole project, as long as these files are not large binary files, otherwise refer to Method 2 below. If you already tried and failed to push, then reset the last commit and try again.

  • git reset –mixed COMMIT-SHA (this will remove those large files from the repository index and make them unstaged but still available locally)

  • git status (will show what changes are currently unstaged)

  • make smaller changes by using `git add file` and commit with smaller commits

  • push each smaller commit to origin

Method 2:

Move large binary files to be tracked as LFS. Since LFS is using media API for uploads, they will not be affected by the Git push size limit. Learn more about using Git LFS with Bitbucket Cloud.

Note: To verify the size of your current push, you can run: git count-objects -vH to confirm the local size is under 3.5 GB.

Happy coding,

The Bitbucket Cloud team

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022