gaochy1126 发表于 2020-9-20 21:27

(转)git submodule update下载子模块时报 Permission denied 错误

本帖最后由 gaochy1126 于 2020-9-20 21:28 编辑

首先通过 git 命令将其从 GitHub 上下载到本地。主工程下载完毕后,还需要下载其内部的子模块。这个同样使用 git 命令即可:

1

git submodule update --init




命令执行后子模块并没有成功更新下拉,报如下错误:Cloning into ‘xxxxxxx’…
The authenticity of host ‘github.com (XXX.XXX.XXX.XXX)’ can’t be established.
RSA key fingerprint is ……
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘github.com,XXX.XXX.XXX.XXX’ (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.


2,解决办法 (1)在项目的文件夹下有一个 .gitmodules 文件,打开发现这里面的模块的 URL 是 git@github.com:XXXXXX/XXXXXX.git 这种形式。



(2)我们把 git 形式的 url 改为 https 形式。



(3)保存后执行如下命令,重新同步一下子模块信息。

1
git submodule sync





(4)再次执行如下代码,即可成功下载子模块了。
1
git submodule update --init





页: [1]
查看完整版本: (转)git submodule update下载子模块时报 Permission denied 错误