summaryrefslogtreecommitdiff
path: root/tools/switch-remote
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2015-12-17 00:30:58 -0500
committerDaniil Baturin <daniil@baturin.org>2015-12-17 00:30:58 -0500
commit8f1c544bff1a411e07832bd19e28977b443485c5 (patch)
tree0a89dadd7b5d70124c2d4c9277012797d8c2aa89 /tools/switch-remote
parent73a06aa42c846c0cf78e6b5537b0a53abdea58d1 (diff)
downloadvyos-build-8f1c544bff1a411e07832bd19e28977b443485c5.tar.gz
vyos-build-8f1c544bff1a411e07832bd19e28977b443485c5.zip
Import the instant git remote switch script.
Diffstat (limited to 'tools/switch-remote')
-rwxr-xr-xtools/switch-remote35
1 files changed, 35 insertions, 0 deletions
diff --git a/tools/switch-remote b/tools/switch-remote
new file mode 100755
index 00000000..328b735c
--- /dev/null
+++ b/tools/switch-remote
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+HTTPS_BASE_URL="https://github.com/vyos"
+SSH_BASE_URL="git@github.com:vyos"
+
+REMOTE=`git config remote.origin.url`
+
+# extract vyatta-foo.git
+BASENAME=`echo $REMOTE | sed -re 's!.*/(.*)$!\1!'`
+echo "Changing remote for $BASENAME"
+
+# Print usage if no arguments given
+if [ -z "$1" ]; then
+ echo "Switches remote URL to SSH or HTTPS"
+ echo "Use \"$0 ssh\" to switch to SSH"
+ echo "Use \"$0 https\" to switch to HTTPS"
+fi
+
+case $1 in
+ ssh)
+ echo "New remote: $SSH_BASE_URL/$BASENAME"
+ git config remote.origin.url $SSH_BASE_URL/$BASENAME
+ ;;
+ https)
+ echo "New remote: $HTTPS_BASE_URL/$BASENAME"
+ git config remote.origin.url $HTTPS_BASE_URL/$BASENAME
+ ;;
+ *)
+ echo "Wrong option, use \"ssh\" or \"https\""
+ ;;
+esac
+
+
+
+