Cloning into ‘.git’…遇到的问题

  • Post author:
  • Post category:其他


注册了github的账号,设置了如下命令


git config –global user.name

git config –global user.email

新建了库HelloWorld

执行命令git clone git://github.com/yiyayitian/HelloWorld .git


(我的github访问地址是

https://github.com/yiyayitian

得到如下:


Cloning into ‘.git’…


fatal: Unable to look up github.com (port 9418) (nodename nor servname provided, or not known)

请问这是什么原因导致的呢?

3 个回答



0

采纳






StephenLee

5.5k


2014年04月12日 回答 ·

2014年04月12日 更新



git clone

用的

git://

协议,但是你明显没配置

ssh

,当然

github

会拒绝你的

clone

请求。


你可以直接改为

https://

协议,

git clone https://github.com/yiyayitian/HelloWorld .git



或者你返回重新配置,添加好ssh 公钥。

 $ssh-keygen -t rsa -C "your email"  //生成公钥,在 id_rsa.pub 文件中



github

上打开你的

account


setting

,在左侧栏找到

SSH keys

,把生成的 ssh 公钥添加进去即可。


这时你再使用之前使用的命令,就不会被拒绝了。



2






Gulakya_Ritchie

31


2014年04月12日 回答

git clone git://github.com/yiyayitian/HelloWorld .git

地址写错了,没有空格

git clone git://github.com/yiyayitian/HelloWorld.git



0






依云

18k


2014年04月12日 回答

fatal: Unable to look up github.com (port 9418) (nodename nor servname provided, or not known)

这是域名解析出错的提示(「Unable to look up github.com」)。你使用的是运营商提供的 DNS 服务器吧(没有自己设置过)?建议使用国内的 114.114.114.114 或者国外(Google)的 8.8.8.8。这两个公开的 DNS 服务器的可靠性要远高于 ISP 提供的破烂玩意儿,还没有域名劫持。

另外,

git clone git://github.com/yiyayitian/HelloWorld .git

这句命令就像

@StephenLee

所说的,你使用了

git://

协议。github 通过此协议只提供读取的功能,因为 github 没办法通过这个协议知道到底是谁在使用(没有授权机制),所以你 clone 下来了也是 push 不了的(当然是可以 clone 的,除非你要 clone 的仓库是私有仓库)。要想 push 到 github,请使用

ssh://

协议(地址可以直接写作

git@github.com:username/reponame

,需要配置 ssh 密钥)或者

https://

协议(每次 push 均需要提供用户名和密码,或者把用户名和密码明文写到 netrc 配置中(我没成功过))。在你的

项目页面的右下角有写

这些不同用处的地址。