Error for push after migrating Bitbucket Server to another machine Edited

Hello,

 

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 https://confluence.atlassian.com/bitbucketserver/migrating-bitbucket-server-to-another-server-776640406.html.

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,

Dorin

2 answers

1 accepted

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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

1,942 views 1 5
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