如何用另一个回购库替换一个git子模块? [英] How do I replace a git submodule with another repo?
问题描述
具体来说,我有一个子模块: 问题是,当我使用描述的方法删除子模块时, stackoverflow.com/questions/1260748/how-do-i-remove-a-git-submodule\">这里,然后使用命令重新添加它 我得到这个错误: 如果子模块的位置,那么你可以简单地:
./ ExternalFrameworks / TestFramework
指向一个git仓库 git@github.com:userA / TestFramework.git
git@github.com:userB / TestFramework.git
git submodule add git@github.com:userB / TestFramework.git
'ExternalFrameworks / TestFramework'的git目录在远程本地找到, :
origin git@github.com:userA / TestFramework.git
如果您想重用此本地git目录而不是克隆ag ain from
git@github.com:userB / TestFramework.git
使用'--force'选项。如果本地git目录不是正确的repo
,或者您不确定这意味着用'--name'选项选择另一个名称。
.gitmodule
文件以使用新的URL
git submodule sync
<更多完整的信息可以在其他地方找到:
>
How do I replace a git submodule with a different git repo?
Specifically, I have a submodule:
- located at
./ExternalFrameworks/TestFramework
that points to a git repogit@github.com:userA/TestFramework.git
- I'd like it to now point to
git@github.com:userB/TestFramework.git
.
The problem is that when I delete the submodule with the method described here, then re-add it using the command
git submodule add git@github.com:userB/TestFramework.git
I get this error:
A git directory for 'ExternalFrameworks/TestFramework' is found locally with remote(s):
origin git@github.com:userA/TestFramework.git
If you want to reuse this local git directory instead of cloning again from
git@github.com:userB/TestFramework.git
use the '--force' option. If the local git directory is not the correct repo
or you are unsure what this means choose another name with the '--name' option.
If the location (URL) of the submodule has changed, then you can simply:
- Modify your
.gitmodule
file to use the new URL - Run
git submodule sync
More complete info can be found elsewhere:
这篇关于如何用另一个回购库替换一个git子模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!