开发者

how do I remove a remote branch when I get an error?

开发者 https://www.devze.com 2023-02-27 08:33 出处:网络
I have tried the following command and it fails. git push origin :next remote: error: denying ref deletion for refs/heads/next

I have tried the following command and it fails.

git push origin :next
remote: error: denying ref deletion for refs/heads/next
To blah.git
 ! [remote rejected] next (deletion prohibited)
error: failed to push some refs to 'blah.git

I am using gitolite and cannot find any of this error message in the hooks. How can I disable this so that I can delete or rename 开发者_如何学Cthis remote branch? When I run git branch -r -d origin/next, it appears to go away, but the next git pull brings it right back.


Make sure in your gitolite config, you have the rewind flag on so instead of RW use RW+. That will allow you to delete branches and commits.

git push -f origin :next


This looks like the error you get when you try to push to a repo that has denyDeletes = true. It's intended to prohibit you from rewriting history in the remote (it is usually accompanied by denyNonFastForwards = true). That being the case, you can only delete the branch by deleting it on the remote; --force won't work.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号