changing underlying repo address

I have a project where I added a git submodule to a fork of a repo that is out of date. Rather than pointing to that fork, I decided to change the submodule reference to point to the original repo instead.

I edited the .gitmodules file to reflect the new reference and ran git submodule init and git submodule update --recursive however there is no effect, am I missing a step here?


neevek mentions .git/config , and the documentation of git config confirms:

submodule..path submodule..url submodule..update

The path within this project, URL, and the updating strategy for a submodule.
These variables are initially populated by git submodule init ; edit them to override the URL and other values found in the .gitmodules file .

So:

  • changing the values in the .gitmodules alone isn't enough (the url in the .git/config will have precedence).
  • git submodule init , as the documentation mentions, does not alter existing information in .git/config (and that explains why your commands didn't have any visible effect).
    You can then customize the submodule clone URLs in .git/config for your local setup and proceed to git submodule update .
  • I personally find this url duplication a bit confusing...

    链接地址: http://www.djcxy.com/p/92320.html

    上一篇: Git以递归方式添加子模块的特定路径下的所有存储库

    下一篇: 改变底层回购地址