Skip to content

Instantly share code, notes, and snippets.

@ball6847
Created September 15, 2017 15:20
Show Gist options
  • Save ball6847/a886f6be44cb425a7e63dca9200ea580 to your computer and use it in GitHub Desktop.
Save ball6847/a886f6be44cb425a7e63dca9200ea580 to your computer and use it in GitHub Desktop.
Simple bash script to download and extract github repo to local directory, just like "git clone" but only the source code.
#!/bin/bash -e
if [ -z $1 ]; then
echo "skel-hub - download and extract github tarball
Usage: $0 user/repo [project]"
exit 1
fi
GITHUB_REPO=$1
if [ -z $2 ]; then
TARGET_NAME=$(basename $GITHUB_REPO)
else
TARGET_NAME="$2"
fi
TARGET_DIR=$PWD
TMPDIR=$(mktemp -d)
cd $TMPDIR
wget -qO- "https://github.com/$GITHUB_REPO/archive/master.tar.gz" | tar -zx --strip-components=1
mv $TMPDIR $TARGET_DIR/$TARGET_NAME
@ball6847
Copy link
Author

example

$ skel-hub kriasoft/react-starter-kit my-react-project

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