Mark Needham

Thoughts on Software Development

Git: Deleting a remote branch on a gitolite configured repository

with one comment

We’ve had an xsbt branch on our gitolite powered repository for the last couple of weeks while we worked out how to move our build from sbt 0.7 to sbt 0.10 but having finally done that we needed to delete it.

I originally tried running the following command from one of our developer workstations:

git push origin :xsbt

But ended up with the following error:

remote: error: denying ref deletion for regs/head/xsbt

! [remote rejected] xsbt (deletion prohibited)

A bit of googling led me to this stackoverflow thread which suggested that you needed to be an administrator in order to delete a remote branch.

Once we’ve done that we can run the following command on each machine to delete the remote tracking reference to the repository:

git branch -d -r origin/xsbt
Be Sociable, Share!

Written by Mark Needham

June 28th, 2011 at 10:09 pm

Posted in Version Control

Tagged with

  • Anonymous

    I only needed to make sure that the branch in question was part of a gitolite rule, not necessarily as an ‘admin’. A group named ‘admin’, in gitolite, is the same as any other (without being used as such, when configuring). In my case, I had:

    repo @repositories
        RW development = @devadmins
        RW+ development/ = @staff
        …

    If permissions are correctly setup, you only need: $ git branch -d -r mybranch