git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Problem deleting remote branches

From
JMJeff Mitchell <kde-dev@emailgoeshere.com>
Date
Nov 26, 2008, 04:04 UTC
Message-ID
<492CCAD7.5000807@emailgoeshere.com>

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

Message 1 of 1 in “Problem deleting remote branches”
  1. Jeff MitchellNov 26, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.