Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"no address associated with name" error when cloning github.com's repo under Windows using ssh

Searching google for +github +ssh "no address associated with name" gives the following SO questions as the 4 top results:

github no address associated with name
Github push origin master not working
Syncing with github
GITHUB setup - no address associated with name

None of them gives answer to my problem, though.

c:\Program Files (x86)\Git\bin>git --version
git version 1.7.7.1.msysgit.0

c:\Program Files (x86)\Git\bin>ssh [email protected]
Enter passphrase for key '/c/Users/Piotr/.ssh/id_rsa':
Hi piotr-dobrogost! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.

c:\Program Files (x86)\Git\bin>git clone ssh://[email protected]:piotr-dobrogost/requests.git
Cloning into requests...
ssh: github.com:piotr-dobrogost: no address associated with name
fatal: The remote end hung up unexpectedly

I guess the problem is caused by git passing github.com:piotr-dobrogost as the hostname to ssh instead just github.com only. Why does git do this and what's the solution?

like image 546
Piotr Dobrogost Avatar asked Nov 16 '11 22:11

Piotr Dobrogost


1 Answers

You answered it yourself - the problem is that you're passing github.com:piotr-dobrogost as the hostname, which is, in fact, not a valid hostname. git will understand either proper URLs to a repository, or a repository path in SCP format (see man 1 scp.) For a proper URL, try:

git clone ssh://[email protected]/piotr-dobrogost/requests.git

Which is equivalent to the following in SCP path format:

git clone [email protected]:piotr-dobrogost/requests.git
like image 199
Edward Thomson Avatar answered Oct 01 '22 16:10

Edward Thomson