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...
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.
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" .
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 ""?
精彩评论