基于SSH协议的git clone,为什么2次结果不一样?

Administrator@WIN-O379IL963GN MINGW64 ~/Desktop/shop/withssh (master)
$ git clone git@github.com:wanghuiwiki/shop.git
Cloning into 'shop'...
The authenticity of host 'github.com (20.205.243.166)' can't be established.
ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
Connection reset by 20.205.243.166 port 22
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Administrator@WIN-O379IL963GN MINGW64 ~/Desktop/shop/withssh (master)
$ git clone git@github.com:wanghuiwiki/shop.git
Cloning into 'shop'...
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 6 (delta 0), reused 3 (delta 0), pack-reused 0
Receiving objects: 100% (6/6), done.

还有一个问题是:现在生成公钥对指令,还需要安装OpenSSH吗?

阅读 2.4k
1 个回答

第一次需要你信任远端,这个是属于 ssh 的;然后后面因为网络原因克隆失败了。

第二次成功了。

你可以用任何的方式去生成密钥对(一般都带有 ssh-keygen 命令可以用来生成),然后默认把私钥放到 ~/.ssh/id_rsa,把公钥在 Github 上填写就好。

本地不需要再安装 OpenSSH。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进