mirror of
https://github.com/vyos/vyos-build.git
synced 2025-10-01 20:28:40 +02:00
Import the instant git remote switch script.
This commit is contained in:
parent
73a06aa42c
commit
8f1c544bff
35
tools/switch-remote
Executable file
35
tools/switch-remote
Executable file
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user