无法在git中删除远程分支 [英] Cannot delete remote branch in git

查看:141
本文介绍了无法在git中删除远程分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的中央git存储库中删除一个远程分支。通常的建议是'git push origin:branchname'或'git push origin:heads / branchname'。但是,当我尝试这样做时,我收到以下错误消息:

I'd like to delete a remote branch from my central git repository. The usual advice is to do 'git push origin :branchname' or 'git push origin :heads/branchname'. But when I try that, I get this error message:


***此存储库中不允许删除分支

错误:hooks / update退出,错误代码为1

错误:hook拒绝更新refs / heads / branchname

到/opt/repo/myrepo.git

! [远程拒绝] branchname(钩子已拒绝)

错误:未能将某些裁判推送到'/opt/repo/myrepo.git'

*** Deleting a branch is not allowed in this repository
error: hooks/update exited with error code 1
error: hook declined to update refs/heads/branchname
To /opt/repo/myrepo.git
! [remote rejected] branchname (hook declined)
error: failed to push some refs to '/opt/repo/myrepo.git'

什么给了?我使用git version 1.5.4.3,如果有帮助的话。

What gives? I'm using git version 1.5.4.3, if that helps.

推荐答案

有人启用了远程回购禁止删除 - 通常这样做是为了让某人不能将重新发行的分支推入回购。 (我维护一个相当大的git仓库集合,它们都以这种方式配置,尽管没有挂钩。)

Someone has enabled a hook in the remote repo that is prohibiting the delete -- this is usually done so that someone can't push a rebased branch into the repo. (I maintain a fairly large collection of git repositories and they are all configured this way, although not with a hook.)

查看远程仓库中的hooks /目录。将会有一个名为update的脚本;这是什么拒绝让你删除分支。

Look in the hooks/ directory in the remote repository. There will be a script named "update"; this is what's refusing to let you delete the branch.

这篇关于无法在git中删除远程分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆