Alright, quick question.

When SSHing to a server using the IP, I can also specify a path to use, such as:

git clone ssh://git@127.0.0.1:/home/git/project.git SomeProject

However, when using a hostname, the command thinks the path is part of the host name:

git clone ssh://git@localhost.com:/home/git/project.git SomeProject

Which yields an error about the : before the path

ssh: localhost.com:: no address associated with name

(Yes, I am aware that I cannot SSH into localhost.com)

Is there a way to specify the path as in the IP example, but with a hostname?

Thanks!

link|improve this question
feedback

2 Answers

up vote 3 down vote accepted

Why you decide, that git SSH URI must have : after hostname? Where you saw this format?

Formal SSH-URI specification is

ssh://[user@]host.xz[:port]/path/to/repo.git/
link|improve this answer
It's derived from scp notation. – Jan Marek Jan 26 at 8:54
That is the strangest thing.... I seriously could not get it working until now. One of those days, I guess. Thanks! – Di-0xide Jan 26 at 8:54
feedback

Why you are using name localhost.com instead of localhost?

link|improve this answer
It's for an example >.> I even stated that I know I cannot connect to localhost.com. – Di-0xide Jan 26 at 8:09
1  
Oh, I see, sorry. Please, try this: git clone git@localhost.com:/home/git/project.git, or git clone ssh://git@localhost.com/home/git/project.git. – Jan Marek Jan 26 at 8:22
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.