繁体   English   中英

为什么git://有效,但git @没有

[英]Why does git:// works but git@ does not

为什么git://有效

$ git clone git://github.com/schacon/grit.git
Cloning into 'grit'...
...
Checking connectivity... done.

但是git @没有

$ git clone git@github.com:schacon/grit.git mygrit
Cloning into 'mygrit'...
Warning: Permanently added the RSA host key for IP address '192.30.252.129' to t
he list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

任何帮助表示赞赏

这是因为git @使用ssh协议。 它相当于ssh:// git @ ..所以如果你没有正确的ssh密钥它将无法工作。 选项git://然而使用git协议,它类似于ssh但根本不使用任何身份验证。 有关更多信息,请参阅协议章节

你的第一个克隆方法是使用git协议,第二个是使用SSH。

您可能没有在github.com上设置SSH令牌

https://help.github.com/articles/generating-ssh-keys

为您提供有关如何设置用户帐户以供SSH使用的步骤。

您可以在这里看到与github相关的协议之间的差异:

https://gist.github.com/grawity/4392747

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM