There are three locations where git keeps track of submodule URL:
.gitmodules
- This is a regular file that is committed in the repository..git/config
.git/modules/somepath/config
git submodule init somepath
: Copies #1 into #2 if #2 does NOT already exist. (The documentation is wrong and makes it sound like it always sets #2.)git submodule sync somepath
: Copies #1 into #2 if #2 already exists.git submodule set-url somepath someurl
: Sets #1, and also syncs (see above).git submodule deinit somepath
: Clears #2 (leaves #3 around!)git config submodule.somepath.url someurl
: Sets #2.git submodule update somepath
: Copies #2 into #3 if #3 does NOT already exist. (e.g. If you haven't cloned the repo yet, clones it using #2.)