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

Re: Getting rid of a stale remote?

From
Tim Visher <tim.visher@gmail.com>
Date
Apr 9, 2010, 02:08 UTC
Message-ID
<m2nc115fd3c1004081908t15ee034bha4909b56621b4936@mail.gmail.com>
In-Reply-To
<20100406184256.GA14281@coredump.intra.peff.net>
On Tue, Apr 6, 2010 at 2:42 PM, Jeff King <peff@peff.net> wrote:
Show 8 quoted lines
> On Tue, Apr 06, 2010 at 02:25:07PM -0400, Tim Visher wrote:
>>     $ git remote rm d
>>     error: Could not remove config section 'remote.d'
>
> And this fails because you have no configured remote 'd', just the
> crufty branch. How you got into that state, I don't know, but I imagine
> it was from deleting the config in .git/config manually instead of using
> "git remote rm" in the first place.
%<---lengthy but almost assuredly misleading explanation of how I got there--->%

So I had this long explanation but I realized that it probably wasn't the case. If I ever run into this again I'll try to be more aware of what I did. I suspect though that it's when I want to make one remote my origin and make origin something else…

Show 7 quoted lines
> It would be tempting to say that "git remote rm" should continue if the
> config simply doesn't exist and remove the crufty branch, but that is
> not quite right. We actually need the config to tell us "here is where
> we store the tracking branches for remote d". Of course, unless you have
> munged the config manually, it will always be "refs/remotes/d". So we
> could perhaps guess that for the case of missing config (possibly with
> "git remote rm -f" or something).
That sounds quite sensible to me.  Also, a message along the lines of:
    You are trying to delete a remote for which there is no config section.  (We
    discovered a remote X in refs/remotes/X) and deleted it.|No remote X in
    refs/remotes/X. Did you store it elsewhere?)  In the future, use `git
    remote` to alter your remotes
> But if you just want to do things manually, try "git branch -d -r
> d/branch".
That did indeed work like a charm.  Thanks so much.
-- 
In Christ,

Timmy V.

http://burningones.com/
http://five.sentenc.es/ - Spend less time on e-mail
Previous: Jeff King
Message 5 of 5 in “Getting rid of a stale remote?”
  1. Tim VisherApr 6, 2010
  2. Ramkumar RamachandraApr 6, 2010
  3. Tim VisherApr 6, 2010
  4. Jeff KingApr 6, 2010
  5. Tim VisherApr 9, 2010

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.