12

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 git@github.com
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://git@github.com: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?

Community
  • 1
  • 1
Piotr Dobrogost
  • 41,292
  • 40
  • 236
  • 366
  • There shouldn't be a colum after github.com, but rather a path (either relative to the git user account, or absolute path). So did you tried `git clone ssh://git@github.com/piotr-dobrogost/requests.git` works better? Or `git clone ssh://git@github.com/home/piotr-dobrogost/requests.git`? – VonC Nov 16 '11 at 22:32
  • `git clone ssh://git@github.com/piotr-dobrogost/requests.git` works and `git clone ssh://git@github.com/home/piotr-dobrogost/requests.git` results in `ERROR: Repository not found.` error. However, the url with colon is given by github as the *official* one. Why doesn't it work? – Piotr Dobrogost Nov 16 '11 at 22:39

3 Answers3

21

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://git@github.com/piotr-dobrogost/requests.git

Which is equivalent to the following in SCP path format:

git clone git@github.com:piotr-dobrogost/requests.git
Edward Thomson
  • 74,857
  • 14
  • 158
  • 187
  • Github gives `git@github.com:piotr-dobrogost/requests.git` (with colon) as the url to use with ssh. Both `git clone ssh://git@github.com/piotr-dobrogost/requests.git` and `git clone git@github.com:piotr-dobrogost/requests.git` work but not `git clone ssh://git@github.com: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? – Piotr Dobrogost Nov 16 '11 at 22:51
  • 2
    Because `ssh://git@github.com:username/repo` is not actually a URL that is equivalent to `ssh://git@github.com/username/repo`. `git@github.com: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. – Edward Thomson Nov 16 '11 at 22:57
  • Could you please add information about git using scp format to your answer? Thanks. – Piotr Dobrogost Nov 17 '11 at 10:16
4

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.

Ido Ran
  • 10,584
  • 17
  • 80
  • 143
0

I am running a private git server with an address assigned by DHCP; this address seems to remain static. From time to time, authenticating with the remote host gives the "no address associated with this name" error.

However, I edit the known_hosts file for my client (which for me resides at C:\Users\MyUserName\.ssh\known_hosts) and delete the line that refers to the private git server:

gitserver.local,10.0.0.10 ssh-rsa AAAABCAAAA....

I then connect again to the git server and issue a pull request. This time, git asks whether to cache the SSH key and the pull concludes successfully, without the "no address associated with name" error.

So, I suspect that something about the RSA key, or how that key relates to DNS, is getting screwed up. If nothing else gives joy, try manually deleting and automatically reinstalling the RSA key on the client. This should not actually work, but it seems to work in my case. I have no clear idea why this should be so.

johnwbyrd
  • 3,432
  • 2
  • 29
  • 25