要修改子仓库的URL,可以使用以下命令:
git config submodule.<submodule-name>.url <new-url>
其中 <submodule-name>
是子模块的名称,<new-url>
是新的URL。
例如,如果要将子模块 my-submodule
的URL从 https://github.com/user/repo.git
修改为 https://github.com/user/new-repo.git
,可以执行以下命令:
git config submodule.my-submodule.url https://github.com/user/new-repo.git
然后提交并推送更改到父仓库中:
git add .gitmodules my-submodule
git commit -m "Update submodule URL"
git push