Reputation: 7
Have a git repo with just the original master branch. What to create something like e.g. http://nvie.com/posts/a-successful-git-branching-model
Anyhow the current master has been used as develop branch. So would like to rename the remote master to develop but get the following error each time.
I am currently doing the follwing:
git branch -m master develop
and get
remote: error: By default, deleting the current branch is denied, because the next
remote: 'git clone' won't result in any file checked out, causing confusion.
remote:
remote: You can set 'receive.denyDeleteCurrent' configuration variable to
remote: 'warn' or 'ignore' in the remote repository to allow deleting the
remote: current branch, with or without a warning message.
remote:
remote: To squelch this message, you can set it to 'refuse'.
remote: error: refusing to delete the current branch: refs/heads/master
To C:/somewhere
! [remote rejected] master (deletion of the current branch prohibited)
I do not have appropriate access to ssh in to the server and change 'receive.denyDeleteCurrent' as indicated and described here e.g. http://dcsg.me/tutorials/how-to-allow-remove-master-branch-from-git/
What option do I have from my local cloned repo side?
EDIT Need to retain all commit history.
Upvotes: 0
Views: 74
Reputation: 740
Create a new branch first, switch it it, then delete the old branch.
git checkout -b [name_of_your_new_branch]
-- create
git checkout [name_of_your_new_branch]
--switch
git push origin [name_of_your_new_branch]
--push to server
Now you should be able to delete your branch.
Granted, you are trying to delete what seems like master which is a bad idea. You most likely just want to do the above with the branch name develop
, and not delete master
.
You will always have multiple branches.
Upvotes: 1