1

I am trying to delete the 'master' branch on remote. Note: I am not trying to delete the local master branch but the master branch on the remote.

The command is

git push origin master --delete

The error I receive is:

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 my:shared/pop.team/pop.TallyWorld
 ! [remote rejected] master (deletion of the current branch prohibited)
error: failed to push some refs to 'my:shared/pop.team/pop.TallyWorld'

I am currently not on master branch.

Also, I don't want any default branch for the repo. Is it possible?

Kindly suggest a solution to delete the master branch on remote.

2
  • What does git status say? Commented Aug 2, 2016 at 11:52
  • Since the working directory is clean(no unstaged changes); git status does not show anything. Commented Aug 2, 2016 at 12:41

1 Answer 1

1

The error message seems to tell exactly what to do. It seems like for reasons unknown to us, git likes to call master the "current" branch (though there really should be no concept of "current" on a bare remote; nevertheless, HEAD points to master on a remote in the default configuration (and I have no idea if there are circumstances where this could be otherwise)).

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.

Also, deleting master seems to have the desired effect of not checking out anything on clone:

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.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.