为什么git://可以工作但是git @不能

为什么git://可以工作但是git @不能

问题描述:

git://为什么起作用

Why does git:// works

$ 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相似,但完全不使用身份验证.有关更多信息,请参见协议章节.

This is because git@ uses ssh protocol. It is equivalent to ssh://git@.. So if you dont have correct ssh keys it will not work. Option git:// however uses git protocol which is similar to ssh but uses no authentication at all. See chapter on protocols for more information.