threads / discuss / 16469

Problem deleting remote branches

Subject: Problem deleting remote branches

## tl;dr

One message between Nov 26, 2008 and Nov 26, 2008.

replies: 0people: 1as markdown or json

Jeff Mitchell· Nov 26, 2008, 04:04 UTC · lore

I'm running into a problem where it seems that you can't delete branches from a remote WebDAV/HTTP repository (at least, not using the methods you would use for a git protocol-based repo). It seems to be looking for the wrong ref head.

Here's a log of running the commands against github, using the native git protocol:

$ git checkout --track -b gittest jefferai Branch gittest set up to track local branch refs/heads/jefferai. Switched to a new branch "gittest"

$ git push origin gittest
Total 0 (delta 0), reused 0 (delta 0)
To git@github.com:jefferai/portage.git
 * [new branch]      gittest -> gittest

$ git checkout jefferai Switched to branch "jefferai"

$ git branch -d -r origin/gittest Deleted remote branch origin/gittest.

$ git push origin :gittest
To git@github.com:jefferai/portage.git
 - [deleted]         gittest

Here's the same (near as I could get it) commands against my http-based server. Note that because of some other weirdness, I delete the local branch that I push up, then re-fetch it as a remote tracking branch, then try to do the delete:

$ git checkout --track -b gittest jefferai Branch gittest set up to track local branch refs/heads/jefferai. Switched to a new branch "gittest"

$ git push myremote gittest
Fetching remote heads...                             
  refs/                                              
  refs/tags/                                         
  refs/heads/                                        
updating 'refs/heads/gittest'                        
  from 0000000000000000000000000000000000000000      
  to   a4641f663ae86739b623a4b5bba7b284e5999549      
                               
done                       
Updating remote server info                         

$ git checkout jefferai Switched to branch "jefferai"

$ git branch -d gittest Deleted branch gittest.

$ git fetch myremote
From https://[my,server.com]/amarok                  
 * [new branch]      gittest    -> myremote/gittest        

$ git checkout --track -b gittest myremote/gittest Branch gittest set up to track remote branch refs/remotes/myremote/gittest. Switched to a new branch "gittest"

$ git checkout jefferai Switched to branch "jefferai"

$ git branch -r -d myremote/gittest Deleted branch gittest.

$ git push myremote :gittest
Fetching remote heads...
  refs/
  refs/tags/
  refs/heads/
fatal: Couldn't get https://[my.server.com]/amarok.git/refs/heads/master
for remote symref
The requested URL returned error: 404
error: failed to push some refs to 'https://[my.server.com]/amarok.git'
Note the third to last line:
Couldn't get https://[my.server.com]/amarok.git/refs/heads/master
On my webserver, in the repository, I have the following in refs/heads:

bookcase amarok.git # ls refs/heads/ gittest jefferai

I do have a "master" branch -- that's where the "jefferai" branch was spawned from, which the "gittest" branch was spawned from -- but I have no idea why it's looking for it.

My remote ref for github looks like:
[remote "origin"]
        url = git@github.com:jefferai/portage.git
        fetch = +refs/heads/*:refs/remotes/origin/*
and my remote ref for my server looks like:
[remote "myremote"]
        url = https://[my.server.com]/amarok.git
        fetch = +refs/heads/*:refs/remotes/myremote/*

This smells like a bug, unless there's something I'm doing wrong that I can't figure out.

Help much appreciated.

Thanks, Jeff

← back to recent threads