简体   繁体   English

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

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

Why does git:// works 为什么git://有效

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

but git@ does not 但是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.

Any help is appreciated 任何帮助表示赞赏

This is because git@ uses ssh protocol. 这是因为git @使用ssh协议。 It is equivalent to ssh://git@.. So if you dont have correct ssh keys it will not work. 它相当于ssh:// git @ ..所以如果你没有正确的ssh密钥它将无法工作。 Option git:// however uses git protocol which is similar to ssh but uses no authentication at all. 选项git://然而使用git协议,它类似于ssh但根本不使用任何身份验证。 See chapter on protocols for more information. 有关更多信息,请参阅协议章节

Your first clone method is using the git protocol, the second is using SSH. 你的第一个克隆方法是使用git协议,第二个是使用SSH。

You probably don't have your SSH token setup on github.com 您可能没有在github.com上设置SSH令牌

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

Gives you the steps on how to setup your user account for SSH use. 为您提供有关如何设置用户帐户以供SSH使用的步骤。

You can see the differences between the protocols as they pertain to github here: 您可以在这里看到与github相关的协议之间的差异:

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

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

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