Skip to content

Instantly share code, notes, and snippets.

@saml
Created January 26, 2016 11:17
Show Gist options
  • Save saml/0ab4290efa1c35828f77 to your computer and use it in GitHub Desktop.
Save saml/0ab4290efa1c35828f77 to your computer and use it in GitHub Desktop.
#!/bin/bash
if (( $# < 1 ))
then
echo "Usage: $0 git-repo [base-dir]"
exit 1
fi
giturl="$1"
gitrepo="${giturl##*://}"
gitname="${gitrepo%.git}"
basedir="${2:-"$HOME/code"}"
targetdir="$basedir/$gitname"
mkdir -p "$targetdir"
git clone "$giturl" "$targetdir"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment