我试图根据these instructions更改子模块上的远程。git子模块同步不起作用
修改和保存.gitmodules
后,然后做git submodule sync
我的子模块并没有改变,虽然我的.git/config
文件已经更新到新的远程URL中.gitmodules
匹配。
我也试过git submodule sync --recursive
,按照this tip做rm -rf .git/modules/<mySubmodule>
没有任何区别。实际上,运行后者命令,然后git submodule sync
再次给出fatal: Not a git repository: ../.git/modules/<mySubmodule>
。有小费吗?
我最初通过git submodule add git://<mySubmodule-url>
按照git docs将子模块添加到项目中。
编辑
我甚至通过自制软件更新混帐到V2.1.1,仍然一无所获。我也尝试从头开始,甚至在两个完全不同的子模块之间切换,但我仍然得到相同的结果。总之:
$> mkdir myRepo
$> cd myRepo
myRepo$> git init .
myRepo$> git submodule add https://<path/to/my/repo>.git
myRepo$> vim .gitmodules
# change submodule url to https://<path/to/another/repo>.git
myRepo$> git submodule synC# updates my .git/config file with the new submodule url, but all my files in the submodule are still from the old url
myRepo$> git submodule sync --recursive # doesn't do anything
myRepo$> git submodule update --init --recursive # doesn't do anything either
myRepo$> rm -rf .git/modules/<mySubmodule> # tip from SO comment linked above
myRepo$> git submodule sync
fatal: Not a git repository: ../.git/modules/<mySubmodule>
只是一个'混帐子模块更新--init --recursive'是行不通的(在'git的子模块同步--recursive'之后)? – VonC 2014-09-29 20:22:03
不 - 我仍然看到原始子模块。 – acannon828 2014-09-29 20:23:41
查看http://stackoverflow.com/questions/3336995/git-will-not-init-sync-update-new-submodules – 2017-01-23 18:02:30