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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

24,967 views 26 12
Join discussion

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