Removing a remote branch in Git
This is something I’ve had to checkup a few times so I figured it would be useful both for myself and for others to keep around in a blog post.
To remove a remote branch you created in Git just push to it like:
$ git push origin :name-of-branch
Hi,
I tried it. But I get the error message
“remote does not support deleting refs”
I access my remote repository via ssh.
Do you have any idea, how I enable remote deleting?
Thanks,
Martin
@Martin, I’m guessing the Git version on your server side is too old. It seems that you need a version of 1.5 or higher.
See, http://kerneltrap.org/mailarchive/git/2008/7/6/2365674
Is it possible to forbid that remote branches can be deleted?
Great! I’ve been going around in circles with this. Using lots of -r -d and getting “remote branch foo deleted” .. git pull … “new branch foo” aaargh.
this fixed it right up.
cheers!
@Stu: Really glad it helped!