Skip to content

Instantly share code, notes, and snippets.

@da1nerd
Created July 9, 2020 16:24
Show Gist options
  • Save da1nerd/fc7b4204085cc6af146c0328f0799a2d to your computer and use it in GitHub Desktop.
Save da1nerd/fc7b4204085cc6af146c0328f0799a2d to your computer and use it in GitHub Desktop.
A utility to quickly clone github repositories.
#!/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
@da1nerd
Copy link
Author

da1nerd commented Jul 9, 2020

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

gitme crystal-lang/crystal ~/test
# clones into `~/test`.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment