Bitbucket: "Repository is over the size limit (4 GB) and will not accept further additions"
The repository on Bitbucket Cloud is over 4 GB, so Bitbucket takes only pushes that undo the latest commits. Your new commits did not reach Bitbucket. Undo the push that took the repository over the limit, then push your work again without the large files.
The whole message
As Atlassian's article Reduce repository size shows it:
remote: Repository is over the size limit (4 GB) and will not accept further additions. remote: remote: Learn how to reduce your repository size: https://confluence.atlassian.com/x/xgMvEw. ! [remote rejected] main -> main (pre-receive hook declined) error: failed to push some refs to 'https://bitbucket.org/<workspace>/<repository>.git'
The push that took the repository past 4 GB went through. The message comes on the next push.
Which limit is it?
- 4 GB per repository (Standard and Premium). Pushes are refused with the message above, except ones that undo the latest commits.
- 2 GB per repository: only a warning in the Repository details panel. Atlassian recommends staying under it.
- 1 GB per Free workspace: all the workspace's repositories together. Since May 29, 2025, a Free workspace over it is put in read-only mode. See how much you use in Workspace settings → Plan details → Workspace storage used. Standard and Premium workspaces do not have this limit. Git LFS files are not in it: they have their own storage, 1 GB on Free ("out of file storage").
- 100 MB per file: the repository setting Block pushes with files over 100 MB, on by default, refuses a push that adds such a file. A workspace or repository admin can turn it off: Repository settings → Repository details → Advanced.
- "remote: fatal: pack exceeds maximum allowed size": one push carried too much at once. Push the work as several smaller commits, one at a time, or move the large files to Git LFS.
Undo the last push, and keep your work
# 1. Keep your local commits on a temporary branch
git branch keeper
# 2. Go back to just before the last commit Bitbucket took
git reset --soft @{u}^
# 3. Push that, rewriting the branch on Bitbucket
git push --force
# 4. Bring your local commits back
git merge --ff-only keeper
git branch -d keeper
These are the commands from Atlassian's article. We ran them against a local git server that takes only pushes that rewind a branch, as Bitbucket does over the limit. Its refusal read like the message above. After step 3 the server's branch ended one commit before the large one. After step 4 the local branch was back where it was, large file included, two commits ahead of the server.
@{u}^undoes one commit. If the last push carried several, use@{u}~2,@{u}~3and so on, or the hash of the commit before them.- Tell everyone who works on that branch: the commit is gone from Bitbucket, and nobody should merge it back.
- If the branch has restrictions, the force push in step 3 needs Allow rewriting branch history; otherwise it is refused with "pre-receive hook declined".
Bitbucket then runs garbage collection by itself, and pushes work again. If the repository is still large after you remove the large files, Bitbucket collects again when it is over 75% of the limit; if that does not help, ask Atlassian Support to run it.
Push your work again, without the large file
Do not push yet: your local branch still has the large file in its history. If it is only in commits Bitbucket does not have, fold them into one commit without it:
git reset --soft @{u}
git rm --cached path/to/large-file
echo "path/to/large-file" >> .gitignore
git add .gitignore
git commit -m "Your message"
git push
On the same local server, with the limit lifted, this pushed one commit without the large file, and the file stayed on disk. If large files are older and already on Bitbucket, you need to rewrite the history: see Atlassian's Maintain a Git repository and Use BFG to migrate a repo to Git LFS. Afterwards everyone makes a new clone; an old clone that is force pushed brings the large files back.
Create Bitbucket pull requests from IntelliJ IDEA
Pull Request Inbox for Bitbucket, a plugin by Lesstep for JetBrains IDEs 2024.1 or later, adds Git → Create Bitbucket Pull Request… for Bitbucket Cloud and Data Center. It opens a pull request from the branch you are on, into the repository's main branch unless you pick another. If the branch is not on Bitbucket yet, it says so and opens the IDE's push dialog first. Creating, approving and merging pull requests are Pro (US$1.50 a month, with a 30-day trial); the review inbox is free.
Get it on JetBrains Marketplace
Bitbucket and Atlassian are trademarks of Atlassian; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with or endorsed by Atlassian or JetBrains.
More: "Your push failed because the account has exceeded its user limit" · "pre-receive hook declined" for branch restrictions · Bitbucket pull request plugins for IntelliJ IDEA, compared · "Your LFS push failed because your account is out of file storage" · 日本語