]> git.parisson.com Git - docker-django-scripts.git/commitdiff
Add --ssh and --https options to use GitHub SSH or HTTPS URLs
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Wed, 13 Dec 2017 11:26:44 +0000 (12:26 +0100)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Wed, 13 Dec 2017 11:26:44 +0000 (12:26 +0100)
update_submodules.sh

index a5624916850de933a3eec3943c385037c5bfb3cc..4a403d916a5bb37315ec5662faa367338aa8239d 100755 (executable)
@@ -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