Deleting remote master branch, refused due to being current branch

别来无恙 提交于 2020-01-09 04:14:09

问题


How do I delete a remote master branch from GitHub/Bitbucket?

I'm trying:

# git push bb --delete master
remote: bb/acl: user is allowed. accepted payload.[K
remote: error: refusing to delete the current branch: refs/heads/master[K
To ssh://git@bitbucket.org/user/reponame.git
 ! [remote rejected] master (deletion of the current branch prohibited)
error: failed to push some refs to 'ssh://git@bitbucket.org/user/reponame.git' 

Also I tried

git push bb :master

But all this is not work.


回答1:


Note: for BitBucket, you would change the default branch by accessing the settings of your repo, and changing the branch at the "Main branch" combo box.

Once the main branch is no longer master, then you can push and remove master.




回答2:


In the settings block on the options tap in the settings page (well, just click on the Settings tab on your github repo page), you are able to change the default branch (you need to have the other default branch on github as well).

After you have done that, you are able to remove it:

$ git push bb :master


来源:https://stackoverflow.com/questions/14040754/deleting-remote-master-branch-refused-due-to-being-current-branch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!