Git子模块代码提交

问题描述

我在AWS Codecommit中有两个存储库,我想将一个存储库作为子模块添加到其他存储库中。 这两个存储库位于角色中,而不位于根帐户中

.gitmodules(Repo1中的文件

[submodule "submodule"]
path = sub/module
url = codecommit://Repo2

使用

git submodules update

我明白了

fatal: transport 'codecommit' not allowed
fatal: clone of 'codecommit://Repo2' into submodule path 'sub/module' Failed

我不能使用HTTPS,因为我不知道如何使用HTTPS切换角色。 我将不胜感激

解决方法

秘密在于将git配置为始终使用传输方式

git config --global --add protocol.codecommit.allow always