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

32,676

Solution 1

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

Solution 2

I had this same problem, and it's turn out it was DNS problem. The DNS settings were wrong and the machines simply could not reach the remote git repository.

Share:
32,676
Piotr Dobrogost
Author by

Piotr Dobrogost

se2021 at p.dobrogost.net

Updated on July 05, 2022

Comments

  • Piotr Dobrogost
    Piotr Dobrogost almost 2 years

    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?

  • Piotr Dobrogost
    Piotr Dobrogost over 12 years
    Github gives [email protected]:piotr-dobrogost/requests.git (with colon) as the url to use with ssh. Both git clone ssh://[email protected]/piotr-dobrogost/requests.git and git clone [email protected]:piotr-dobrogost/requests.git work but not git clone ssh://[email protected]:piotr-dobrogost/requests.git. Why does git handle colon when using url without ssh scheme and doesn't handle when using url with ssh scheme?
  • Edward Thomson
    Edward Thomson over 12 years
    Because ssh://[email protected]:username/repo is not actually a URL that is equivalent to ssh://[email protected]/username/repo. [email protected]:username/repo is not a URL at all - it's in the format of the SCP user@host:file argument type (see man 1 scp), which the git client translates into the proper format.
  • Piotr Dobrogost
    Piotr Dobrogost over 12 years
    Could you please add information about git using scp format to your answer? Thanks.