本文介绍了“没有与姓名关联的地址”使用ssh在Windows下克隆github.com的回购时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述









然而,它们都没有给出我的问题的答案。

  c:\程序文件(x86 )\Git\bin> git --version 
git版本1.7.7.1.msysgit.0

c:\程序文件(x86)\Git\bin> ssh git @ github.com
输入密钥的密码/c/Users/Piotr/.ssh/id_rsa:
喜彼得 - dobrogost!您已成功通过身份验证,但GitHub不提供shell访问权限。
连接到github.com关闭。

c:\程序文件(x86)\Git\bin> git克隆ssh://[email protected]:piotr-dobrogost / requests.git
克隆到请求中。 ..
ssh:github.com:piotr-dobrogost:没有与名称
相关的地址致命:远程端意外挂起

我猜这个问题是由于git传递 github.com:piotr-dobrogost 作为ssh的主机名而不是<$只有c $ c> github.com 。为什么git会这样做以及解决方案是什么?解决方案

你自己回答了 - 问题在于你传递了 github.com:piotr-dobrogost 作为主机名,实际上它不是一个有效的主机名。 git会理解正确的URL到存储库或SCP格式的存储库路径(请参阅 man 1 scp 。)要获得正确的URL,请尝试:

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

这与SCP路径格式相同:

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


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?

解决方案

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

这篇关于“没有与姓名关联的地址”使用ssh在Windows下克隆github.com的回购时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 07:52