如何将 core.sshCommand 选项传播到子模块更新?

pla*_*etp 5 git ssh ssh-keys git-submodules

我已经core.sshCommand为存储库设置了选项,以便在使用它时可以使用不同的 ssh 密钥(即sshCommand = ssh -i /path/to/key)。但是,当我运行时git submodule update不考虑此选项:

fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Run Code Online (Sandbox Code Playgroud)

有什么方法可以配置存储库以将给定的 ssh 密钥用于自身和任何子模块吗?

phd*_*phd 7

要么全局设置:

git config --global core.sshCommand "ssh -i /path/to/key"
Run Code Online (Sandbox Code Playgroud)

但这为您使用的每个存储库设置了密钥。

或者为每个子模块设置它:

git submodule foreach git config core.sshCommand "ssh -i /path/to/key"
Run Code Online (Sandbox Code Playgroud)


归档时间:

查看次数:

16152 次

最近记录:

5 年,2 月 前