From: Guillaume Pellerin Date: Wed, 13 Dec 2017 11:26:44 +0000 (+0100) Subject: Add --ssh and --https options to use GitHub SSH or HTTPS URLs X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=c804367449ac41d3fd0af54dd96d5038965b06c4;p=docker-django-scripts.git Add --ssh and --https options to use GitHub SSH or HTTPS URLs --- 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