“no address associated with name” error when cloni

2019-02-04 22:22发布

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?

3条回答
做自己的国王
2楼-- · 2019-02-04 22:33

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
查看更多
3楼-- · 2019-02-04 22:38

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.

查看更多
ゆ 、 Hurt°
4楼-- · 2019-02-04 22:44

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.

查看更多
登录 后发表回答