Created
September 6, 2017 14:25
-
-
Save antonioribeiro/e89362f9ed7c7f0a2f93e32bbb392cbb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function clone () { | |
[email protected]:$1.git | |
echo "Cloning $REPOSITORY using SSH..." | |
git clone $REPOSITORY $2 2>/dev/null | |
if [[ $? -ne 0 ]] | |
then | |
REPOSITORY=https://github.com/$1.git | |
echo 'Falling back to HTTPS ($REPOSITORY)...' | |
git clone $REPOSITORY $2 | |
if [[ $? -ne 0 ]] | |
then | |
echo "Unable to clone $1" | |
exit 1 | |
fi | |
fi | |
echo "Cloned successfully." | |
} | |
## Usage: | |
clone owner/repo <dir-name> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment