Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Change a git submodule remote

To change a git submodule's remote (in this case, from HTTPS to SSH):

SUB=my-submodule-name
$REMOTE=git@gitlab.com:path/to/remote.git

git submodule deinit $SUB
git rm $SUB
git commit -m "removed $SUB submodule at https remote"
rm -rf .git/modules/$SUB
git submodule add $REMOTE $SUB
git commit -m "added back $SUB submodule at ssh remote"
git push origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.