git - 在 git 上删除远程分支时被拒绝

标签 git gerrit

尝试删除远程分支时出现以下错误:

$ git push work :18300-018_5
remote: Processing changes: refs: 1, done
! [remote rejected] 18300-018_5 (can not delete references)
error: failed to push some refs  [...]

知道这是什么意思吗?

最佳答案

这看起来像是 Gerrit 的回答,如 function parseDelete() 中所示.

  private void parseDelete(final ReceiveCommand cmd) {
    RefControl ctl = projectControl.controlForRef(cmd.getRefName());
    if (ctl.canDelete()) {
      // Let the core receive process handle it
    } else {
      reject(cmd, "can not delete references");
    }
  }

这是指向 push policy controlled by Gerrit 的链接.

This category controls how users are allowed to upload new commits to projects in Gerrit.
Deletion of existing branches is rejected. This is the safest mode as commits cannot be discarded.

因此,除非您在此 Gerrit 类别上激活“强制选项”,否则您将无法删除该服务器上的分支。

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

相关文章:

git - 如何摆脱gerrit中的错误依赖

linux - 有没有办法在 git merge 后获取所有冲突的代码片段(不仅仅是文件)?

git 将一个提交复制到新分支

git - 如何减少 Bitbucket 上的 git repo 大小?

git - 从 jenkins 执行 git describe 命令

带有 gerrit 的 Git 镜像

java - gerrit 和 OpenID_SSO

node.js - Windows 上的 Git bash 或 NPM 正在将参数转换为路径

git - 压缩 : from the initial commit to another 范围内的历史记录

github - 在 gerrit 中进行全文搜索?