Skip to content

Commit

Permalink
local/bin/git-get: Fallback to HTTPS when SSH fails
Browse files Browse the repository at this point in the history
  • Loading branch information
Ambrevar committed May 24, 2018
1 parent 96de172 commit a85b531
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions .local/bin/git-get
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

DOMAIN=bitbucket.org
DOMAIN=github.com
USER=ambrevar

usage () {
Expand All @@ -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)
Expand All @@ -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

0 comments on commit a85b531

Please sign in to comment.