git - 删除远程主分支,由于是当前分支而被拒绝

标签 git github bitbucket

如何从 GitHub/Bitbucket 删除远程 master 分支?

我正在尝试:

# 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' 

我也试过了

git push bb :master

但这一切都不起作用。

最佳答案

注意:对于 Bitbucket,您可以通过访问存储库的设置来更改默认分支,并在“Main branch”组合框。

Main branch on Bitbucket

一旦主分支不再是master,那么you can push and remove master .

MarsAndBackthe comments 中确认这也适用于 GitHub。

关于git - 删除远程主分支,由于是当前分支而被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14040754/

相关文章:

linux - GitLab:无法从远程存储库读取

android - 如何设置 Cordova?

github - 如何将 readme.md 放在页面顶部

ssh:连接到主机 bitbucket.org 端口 22:连接超时致命

git - 为什么 Jenkins 收到 git submodule update 的 Authentication Failed 错误?

Bitbucket Hooks 与 Webhooks

Git 格式补丁不显示在 Jenkins 控制台中

Android Studio Gradle 选项卡

kubernetes 中的 Gitsync 部署不正确

mysql - 如何在 GitHub 上包含 MySQL 数据库模式?