From c804367449ac41d3fd0af54dd96d5038965b06c4 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Wed, 13 Dec 2017 12:26:44 +0100 Subject: [PATCH] Add --ssh and --https options to use GitHub SSH or HTTPS URLs --- update_submodules.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/update_submodules.sh b/update_submodules.sh index a562491..4a403d9 100755 --- a/update_submodules.sh +++ b/update_submodules.sh @@ -16,6 +16,19 @@ then curr_branch="dev" fi +function update_git_urls { + find ./ -type f \( -name ".gitmodules" -o -name "config" \) -exec sed -i $REGEX {} + +} + +if [ "$1" = "--ssh" ]; then + REGEX='s/https:\/\/github.com\//git@github.com:/g' + update_git_urls +fi + +if [ "$1" = "--https" ]; then + REGEX='s/git@github.com:/https:\/\/github.com\//g' + update_git_urls +fi # checkout new submodule git submodule update --init -- 2.39.5