local/bin/git-get: Fallback to HTTPS when SSH fails

master
Pierre Neidhardt 2018-05-24 15:27:14 +02:00
parent 96de172f44
commit a85b5316dc
1 changed files with 3 additions and 7 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh
DOMAIN=bitbucket.org
DOMAIN=github.com
USER=ambrevar
usage () {
@ -11,18 +11,14 @@ Clone git repo(s) from $DOMAIN:$USER.
Options:
-h: Show this help.
-d DOMAIN: Set domain.
-u USER: Set repository owner.
EOF
}
while getopts ":hd:u:" opt; do
while getopts ":d:u:" opt; do
case $opt in
h)
usage
exit 1 ;;
d)
DOMAIN=$OPTARG ;;
u)
@ -46,5 +42,5 @@ if ! command -v git >/dev/null 2>&1; then
fi
for i; do
git clone "git@$DOMAIN:/$USER/$i"
git clone "git@$DOMAIN:/$USER/$i" || git clone "https://$DOMAIN/$USER/$i"
done