Error for push after migrating Bitbucket Server to another machine Edited



I recently had to migrate the Bitbucket Server from the machine we are currently using to a brand new one. I have followed the documentation provided at

The process was rather straight forward and I managed to go through all the steps:

- I chose to copy the previous instalation and not reinstall the software

- I had to user a database backup since the servers were not visible for each other

- I copied the BITBUCKET_HOME directory separately since it was (at another location)

- I updated the configure files for the new environment

Everything seemed to work well and I managed to pull the repository from the new location. While testing the new setup, I found out that I could not push changes to origin\master. Every time I try this I get the following error: 

"remote: Rewriting history is not allowed for branch refs/heads/master.
remote: Check your branch permissions configuration with the project administrator."

Can anyone help with this issue? I've tried to google the issue, however I found nothing related to this error and a Bitbucket repository migration. I did read the other links, however they did not seem to apply.


Thank you for your time,


2 answers

1 accepted

0 votes
Accepted answer

Seems it was an issue with Bitbucket. We were using version 4.2. After upgrading to the latest version (5.2) it works properly.


I'm sure you can push to a different branch.  E.g. try this:

git push origin HEAD:refs/heads/test-push

The error message you're seeing just means 'master' has a branch permission configured against it.

Click on the repo in the Bitbucket web-ui, and then click on Settings -> Branch Permissions (note: you need to have admin privileges for the repo).

You should see the "no history rewriting" branch permission set for 'master' or for a pattern that matches 'master'.

This is very sensible config setting to have active.  I disable history rewriting for 'master' in all my repos.



Thank you for answering. I understand why you would not want to lose all the history for the master branch.

I've already checked the "no history rewriting" branch permission for 'master' and it is present. The same configuration is, however, on the server that I migrated from (the initial one). And, there, I can push directly to master.

This issue puzzles me, though. Why would a push rewrite the history instead of just adding an new entry in said history?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

1,925 views 7 10
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