From ad4e1ae3cbb61b907fc3673f754e60817cd7528d Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 17 Aug 2014 00:47:59 +0900 Subject: [PATCH] fix git clone url --- setup.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/setup.sh b/setup.sh index f23cda6..3539aef 100755 --- a/setup.sh +++ b/setup.sh @@ -106,7 +106,7 @@ detect_systems(){ setup_selfupdate(){ _msg "Download latest setup.sh from 10sr repository." - mkdir -p "$DOTFILES_DIR" + mkdir -p "$DOTFILES_nDIR" _download $_dotfiles_url_base/setup.sh "$DOTFILES_DIR/"setup.sh chmod +x "$DOTFILES_DIR"/setup.sh } @@ -121,13 +121,24 @@ setup_dotfiles(){ if test "$1" = "--git" then # git clone - _msg "Using git" + _msg "Option \"--git\" has been given. Using git" if test -d "$DOTFILES_DIR"/.git then _warn "Git repository $DOTFILES_DIR already exists" _warn "Skipping" else - git clone git@github.com:10sr/dotfiles.git "$DOTFILES_DIR" + _msg "Checking github.com connectivity" + ssh git@github.com 2>/dev/null && true + if test $? -eq 1 + then + _git_clone_url=git@github.com:10sr/dotfiles.git + _msg "Authentication succeeded" + else + _git_clone_url=https://github.com/10sr/dotfiles.git + _msg "Authentication failed" + fi + _msg "Git cloning $_git_clone_url" + git clone $_git_clone_url "$DOTFILES_DIR" fi else for f in $@ @@ -393,7 +404,6 @@ setup_env(){ # main main(){ - detect_systems if test -z "$1"