10
5
I cannot remove origin/master
from my server. No idea why.
The error message is the following
remote: error: By default, deleting the current branch is denied, because the next
remote: error: 'git clone' won't result in any file checked out, causing confusion.
remote: error:
remote: error: You can set 'receive.denyDeleteCurrent' configuration variable to
remote: error: 'warn' or 'ignore' in the remote repository to allow deleting the
remote: error: current branch, with or without a warning message.
remote: error:
remote: error: To squelch this message, you can set it to 'refuse'.
remote: error: refusing to delete the current branch: refs/heads/master
To acanzian@elab.ecn.purdue.edu:/export/home/a/elabshare/git/ID-check.git
! [remote rejected] master (deletion of the current branch prohibited)
error: failed to push some refs to 'acanzian@elab.ecn.purdue.edu:/export/home/a/elabshare/git/ID-check.git'
No, I am not using Github.
1Why would you want to do that? Are there other branches? – Daniel B – 2014-04-30T16:14:24.673
Indeed there are other branches (check the link to the image, actually, could you display it for me, please?). We had to rebase
master
, and we did it on a temporal branch which now should becomemaster
. The only problem is that I don't know why I cannot kill master on the server. – Atcold – 2014-05-01T20:53:13.9832Maybe not the answer you're looking for, but you could force-push the rebased
master
toorigin/master
, effectively replacing the old one with the new one. – SlightlyCuban – 2014-05-01T21:28:17.763In addition to the error message, please post the command you're using. – Kyralessa – 2014-05-01T22:51:49.117
@Kyralessa, check the screenshot. – Atcold – 2014-05-03T16:58:23.050
@SlightlyCuban, I was trying to avoid forcing stuff and find instead a "clean" way :) – Atcold – 2014-05-03T18:11:45.257
You're not the only one I've seen with the notion that "force" is a terrible or messy thing to do. We're always told not to force things. Forcing a door knob might break it. Forcing a screw might strip the head. But forcing Git isn't going to do any damage, as long as you're aware of what commits it'll replace. You won't mess up Git or break it or leave it unable to function. Having to put
-f
is just a way of saying, "I realize that when doing this, I could lose work, but I know what I'm doing, so go ahead and do it anyway." – Kyralessa – 2014-05-04T22:55:08.827@Atcold, I don't normally recommend forcing, but it sounded like you were going to point
master
to a different branch anyway. In this case,--force
anddelete && push
would have the same end-result. The only difference: deleting would be a 2-step operation, which might be cleaner if you didn't plan to push immediately after. – SlightlyCuban – 2014-05-05T14:19:43.253@SlightlyCuban, my first concern was understanding why my machine was not bending to my will. Now I'm her master again! :) – Atcold – 2014-05-05T23:26:33.697