try transforming remote to https url magically, dunno if this is smart

This commit is contained in:
Mark Riedesel 2024-11-20 17:58:11 -06:00
parent b87403801f
commit 759d6f217e

View file

@ -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."