tags:

views:

46

answers:

3

I'm trying to clone a local git repository. The repository's name contains a `:'. This is confusing both me and git. I get the following error:

~/work/c% git clone ../a::b .
Initialized empty Git repository in /home/user/work/c/.git/
ssh: Could not resolve hostname ../a: Name or service not known
fatal: The remote end hung up unexpectedly

How would you escape the `:'? For now I'm just changing the name of the original repository :-)

I'm using zshell...

+1  A: 

Does:

git clone -- ../a::b .

git clone -- "../a::b" .

git clone --local -- "../a::b" .

works better?

  • The '--' will force git to consider ../a::b . as path parameters, not as options.
  • The --local might help making Git use the right transport mechanism (a simple local copy)

Just to be sure, you could also try using the octal value of the colon character:

git clone -- "../a\072\072b" .
VonC
nope, i already tried that :-)maybe i need to change something in my shell config in order for that to work?
zshgit
@zshgit: you did add the '`--`' before the repo path?
VonC
@VonC: yes, the `--' is there. i get the same original error. thanks :-)
zshgit
@zshgit: just added the "octal value" trick for the colon character, for you to check.
VonC
@VonC: thanks! no, even with the octal, git still tries to go remotely: "fatal: '../a\072\072b' does not appear to be a git repository". maybe jcordasc is in the right...
zshgit
A: 

Don't know but perhaps with a UI client like Tortoise it works?

It seems git understand your a::b like a hostname:port...

Have you tried with ""?

Sebastien Lorber
mmh.. tortoise? maybe i need something simpler :-). yes, it seems that the `:' fools it into thinking `hostname:port'.i tried "blabla" and a\:\:b ...thanks.
zshgit
+2  A: 

It seems that this shouldn't be possible. If you read the Git URLs section of the git-pull manpage, you'll see that there's a special syntax that uses the '::' as a separator. More info on this <transport>::<address> construct can be found at the git-remote-helpers manpage.

As for finagling an interpretation other than this, it appears the expansion is taking place in git, and not in zsh, bash, or your shell of choice.

jcordasc
This could be it. Next time, I'll try to go easy on my Perl fanboyism...
zshgit