threads / bug / 10355

[BUG] git remote add failure

Subject: [BUG] git remote add failure

## tl;dr

3 messages between Oct 18, 2007 and Oct 19, 2007.

replies: 2people: 3as markdown or json

Guido Ostkamp· Oct 18, 2007, 08:55 UTC · lore
Hello,
I think I've found a bug in "git remote add". I tried the following:

$ git remote add -f spearce2 http://repo.or.cz/git/spearce.git Cannot get the repository state from http://repo.or.cz/git/spearce.git fetch spearce2: command returned error: 1

Obviously I used the wrong URI. Then I tried again:

$ git remote add -f spearce2 http://repo.or.cz/r/git/spearce.git remote spearce2 already exists.

I think Git should not store the bad info and block the name when the first call wasn't successfull.

Regards
Guido
Johannes Schindelin· Oct 18, 2007, 16:09 UTC · re: Guido Ostkamp · lore

Re: [BUG] git remote add failure

Hi,
On Thu, 18 Oct 2007, Guido Ostkamp wrote:
Show 13 quoted lines
> I think I've found a bug in "git remote add". I tried the following:
> 
> $ git remote add -f spearce2 http://repo.or.cz/git/spearce.git
> Cannot get the repository state from http://repo.or.cz/git/spearce.git
> fetch spearce2: command returned error: 1
> 
> Obviously I used the wrong URI. Then I tried again:
> 
> $ git remote add -f spearce2 http://repo.or.cz/r/git/spearce.git
> remote spearce2 already exists.
> 
> I think Git should not store the bad info and block the name when the
> first call wasn't successfull.

The problem there is of course that the fetch could fail because you are offline. In that case, you do not want git remote to throw the information away.

BTW you missed the trailing slash in the HTTP URL, I guess.

Ciao, Dscho

Shawn O. Pearce· Oct 19, 2007, 00:20 UTC · re: Johannes Schindelin · lore

Re: [BUG] git remote add failure

Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
Show 19 quoted lines
> On Thu, 18 Oct 2007, Guido Ostkamp wrote:
> 
> > I think I've found a bug in "git remote add". I tried the following:
> > 
> > $ git remote add -f spearce2 http://repo.or.cz/git/spearce.git
> > Cannot get the repository state from http://repo.or.cz/git/spearce.git
> > fetch spearce2: command returned error: 1
> > 
> > Obviously I used the wrong URI. Then I tried again:
> > 
> > $ git remote add -f spearce2 http://repo.or.cz/r/git/spearce.git
> > remote spearce2 already exists.
> > 
> > I think Git should not store the bad info and block the name when the
> > first call wasn't successfull.
> 
> The problem there is of course that the fetch could fail because you are 
> offline.  In that case, you do not want git remote to throw the 
> information away.

Right. But maybe there should be an easier way for the user to "force" adding the remote over the existing remote. Much like how they can force creating a branch over an existing branch.

Too bad -f is already taken.  :-\
-- 
Shawn.

← back to recent threads