如何删除远程主分支?

时间:2016-08-02 11:06:41

标签: git branch git-branch master

我正在尝试删除远程的'master'分支。注意:我不是要删除本地主分支,而是删除远程主分支

命令是

git push origin master --delete

我收到的错误是:

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'

我目前不在主分支上。

另外,我不想要repo的任何默认分支。有可能吗?

请建议删除远程主分支的解决方案。

1 个答案:

答案 0 :(得分:1)

错误消息似乎准确地说明了要做什么。似乎由于我们不知道的原因,Control + C喜欢将git称为“当前”分支(尽管在裸露的遥控器上确实应该没有“当前”的概念;但是,{{1}在默认配置中指向遥控器上的master(我不知道是否存在其他情况)。

HEAD

此外,删除master似乎具有不在克隆上检查任何内容的预期效果:

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.