git submodule update --init --recursive 时遇到 fatal: clone of ‘...‘ into submodule path ‘...‘ failed

问题描述

报错信息:

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of ‘[email protected]:MJPA/SimpleJSON.git’ into submodule path ‘E:/project/pixyz/PiXYZCore/thirdparty/SimpleJSON’ failed
Failed to clone ‘PiXYZCore/thirdparty/SimpleJSON’ a second time, aborting

解决方法

  1. 在本机生成 ssh 公钥,并复制到 GitHub 的 ssh
    打开 cmd,在命令行运行
ssh-keygen

生成类型和目录全选 yes ,生成公钥(id_rsa.pub)和私钥(id_rsa),默认目录在用户名文件夹下的 .ssh 文件夹中(可以复制上方 yes 部分的目录名称)

将 id_rsa.pub 全部复制后放到 Github 的 ssh 下(主页 -> 个人头像 -> Settings -> SSH and GPC keys)

  1. 在本机尝试 clone 一个仓库,遇到下方对话,输入yes,相当于在 .ssh 文件夹的 known_hosts 中 加入了 github 的 hosts

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

  1. 再次运行 git submodule update --init --recursive,可以顺利运行

猜你喜欢

转载自blog.csdn.net/iteapoy/article/details/131675482