diff --git a/bin/dotfiles b/bin/dotfiles index d75f2cf..b61c9b7 100755 --- a/bin/dotfiles +++ b/bin/dotfiles @@ -33,11 +33,23 @@ function smart_clone() { die "$DOTFILES_ROOT already exists, aborting." fi else - ssh -o StrictHostKeyChecking=accept-new "${DOTFILES_REMOTE%%:*}" - git clone --bare $DOTFILES_REMOTE $DOTFILES_ROOT --branch $DOTFILES_BRANCH + # If we have ssh keys that our host accepts + if ssh -o BatchMode=yes -o StrictHostKeyChecking=accept-new "${DOTFILES_REMOTE%%:*}" exit; then + git clone --bare $DOTFILES_REMOTE $DOTFILES_ROOT --branch $DOTFILES_BRANCH + else + git clone --bare $(remote_ssh_to_https $DOTFILES_REMOTE) $DOTFILES_ROOT --branch $DOTFILES_BRANCH + fi fi } +function remote_ssh_to_https { + remote="$1" + remote="${remote/://}" + remote="${remote/git@/https://}" + remote="${remote%.git}" + echo "$remote" +} + function check_requirements() { for DEP in ${DEPENDENCIES[@]}; do has $DEP || die "${DEP} not found, please install and try again."