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

作者站长头像
站长
· 阅读数 10
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吗?

回复
1个回答
avatar
test
2024-07-13

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

第二次成功了。

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

本地不需要再安装 OpenSSH。

回复
likes
适合作为回答的
  • 经过验证的有效解决办法
  • 自己的经验指引,对解决问题有帮助
  • 遵循 Markdown 语法排版,代码语义正确
不该作为回答的
  • 询问内容细节或回复楼层
  • 与题目无关的内容
  • “赞”“顶”“同问”“看手册”“解决了没”等毫无意义的内容