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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.