Skip to main content

Change git submodule URL

··68 words·1 min

If the location (URL) of the submodule has changed, then you can simply:

  1. Modify the .gitmodules file in the repo root to use the new URL.

  2. Delete the submodule folder in the repo

    $ rm -rf .git/modules/<submodule>
    
  3. Delete the submodule folder in the working directory

    $ rm -rf <submodule>
    
  4. Run

    $ git submodule sync
    
  5. And run

    $ git submodule update
    

More complete info can be found elsewhere:

https://stackoverflow.com/questions/913701/changing-remote-repository-for-a-git-submodule