Git 子模块使用不同的 ssh 密钥?

Git submodule using a different ssh key?

我正在尝试将私有存储库添加为 git 子模块。

我可以像这样克隆存储库 git clone <repo_url> 但是当我使用 git submodule add <repo_url> <folder_destination> 我回来了:

Permission denied (publickey). fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

出于某种原因,我的 .git/modules 文件夹的所有权已更改为 root。

我通过 运行 解决了这个问题:

chown -R philip:philip .git/modules/