Lesstep
Bitbucket Cloud and Data Center · git push · Checked October 28, 2026

Bitbucket: "! [remote rejected] main -> main (pre-receive hook declined)"

Bitbucket checked the push against the branch's restrictions and refused it. The branch on Bitbucket did not change, and your commits are still in your local branch. Most often the branch takes changes only through pull requests, or only some people may write to it: put your commits on a new branch, push that, and open a pull request.

The whole message

Bitbucket Cloud, as Atlassian's own article shows it:

 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://bitbucket.org/<workspace>/<repository>'

Older public reports also show a line above it: remote: permission denied to update branch <branch>.

Bitbucket Data Center names the reason, as a report in Atlassian's bug tracker shows:

remote: Branch refs/heads/<branch> can only be modified through pull requests.
remote: Check your branch permissions configuration with the project administrator.

If the lines above it say remote: Repository is over the size limit (4 GB) and will not accept further additions., the cause is the repository's size, not a branch restriction: see how to undo the last push.

What Atlassian lists as the causes

For Bitbucket Cloud, from Atlassian's article Unable to push to repository – "pre-receive hook declined" error (updated September 26, 2025):

For Bitbucket Data Center, the restriction is Prevent changes without a pull request: it blocks pushing directly to the branch. A project or repository admin can exempt users, groups or access keys (Using branch permissions).

Move your commits to a pull request

# 1. Put your commits on a new branch (you stay on them)
git switch -c my-change

# 2. Push the new branch
git push -u origin my-change

# 3. Set your local main back to where the server has it
git branch -f main origin/main

We ran these against a local git server that refuses pushes to main. Its refusal read exactly like Bitbucket Cloud's, ! [remote rejected] main -> main (pre-receive hook declined). The commits ended up on my-change on the server, and the local main matched origin/main again. Do step 3 only after step 2 succeeded. With Git older than 2.23, use git checkout -b my-change for step 1.

Then open the pull request from my-change into main. On Bitbucket Cloud: Create → Pull request, fill in the form, and Create pull request. If the new branch is refused too, a restriction covers more branches than main (Atlassian lets one rule match a name pattern such as release/*): ask the repository admin which branch names you may push.

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: The same refusal when a pipeline pushes: "Permission denied to update branch" · Bitbucket pull request plugins for IntelliJ IDEA, compared · 日本語