Subject: Re: git clone does not understand insteadOf URLs

From: John Keeping <[email-masked]>
Date: Sun, 26 May 2013 20:00:19 +0100

On Sun, May 26, 2013 at 08:21:45PM +0200, Gioele Barabucci wrote:
> Il 26/05/2013 20:14, John Keeping ha scritto:
> > On Sun, May 26, 2013 at 08:09:56PM +0200, Gioele Barabucci wrote:
> >> Il 26/05/2013 20:00, Andreas Schwab ha scritto:
> >>>> Simple, I keep all my projects on the same server, so I would like to
> >>>> refer to that server + path using 'remote-repo'.
> >>>>
> >>>> "git+ssh://git.example.org//users/gioele/projects" insteadOf "remote-repo"
> >
> > In what way do you think that `git remote add` handles the path?
> >
> > All `git remote add` does is add a new "remote.<name>.url" entry to the
> > configuration file with the value as given on the command line.  The
> > insteadOf mapping will only be applied when you try to fetch from/push
> > to the remote.
> 
> Regardless of the implementation of the commands, if I do
> 
>      mkdir projectA
>      cd projectA
>      git init .
>      git remote add origin remote-repo/projectA.git
>      git pull origin master
> 
> I get a working repository. If I do
> 
>      git clone remote-repo/projectA.git
> 
> all I will get is an error.

So the problem is that "git clone" does not seem to perform normal
remote processing if you give it something that looks like a path.

More specifically, it looks like the problem is that if you give clone
something that does not contain a colon (':') it considers it to be a
local path and dies if that path does not exist.  Adding a colon as
Andreas suggested makes it look like a remote URL so it will be handled
correctly.