git clone:url git@github.com / ...和url git://github.com/之间的区别是什么

时间:2013-10-30 15:21:34

标签: git url github clone

我正在关注http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository上的git基础知识指南,在Can't clone repo using git clone git://... - ok with git clone http://回答关于如何使用git URL克隆回购的初步问题之后,我现在想知道是什么不同之处在于书中所说的内容:

  

git clone git://github.com/org_name/repo_name.git

  

git clone git@github.com:org_name / repo_name.git

后者适用于我,书中的行没有,并给我错误信息

  

克隆到'repo_name'   致命:无法连接到github.com:   github.com:ai_socktype

不支持Servname

虽然明显的答案是“使用有效的方法”,但了解差异是什么以及导致它的原因是很好的。

3 个答案:

答案 0 :(得分:2)

第一个使用git自己的协议,并对一个特殊的git守护进程起作用。后者通过SSH访问repo。协议将更详细地解释here

答案 1 :(得分:2)

第一个(git://...)指定使用git协议,但没有说明要使用的用户名。第二个git@github.com:...指定用户git,但未指定协议,因此将使用ssh进行连接。

答案 2 :(得分:1)

第一个使用git协议,第二个使用ssh协议。由于github不提供git协议访问,因此您收到错误。