Created
July 9, 2020 16:24
-
-
Save da1nerd/fc7b4204085cc6af146c0328f0799a2d to your computer and use it in GitHub Desktop.
A utility to quickly clone github repositories.
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
#!/usr/bin/env bash | |
BASE_DIR=~/git | |
set -e | |
echo "this tool will clone a Github repo into your ~/git folder" | |
if [[ $# -lt 1 ]] | |
then | |
echo "give me a 'user/repo'! If you want to specify the clone directory do it after the user/repo!" | |
exit 1 | |
fi | |
# set custom dest dir | |
if [[ $# -eq 1 ]] | |
then | |
DEST=$BASE_DIR/$1 | |
else | |
DEST=$2 | |
fi | |
git clone [email protected]:$1 $DEST |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Make this executable and put it somewhere in your
$PATH
.Then you can clone stuff like this.
gitme crystal-lang/crystal # clones into `~/git/crystal-lang/crystal`.
Or you can tell it to clone to a specific directory