Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
save a subpath of a github repository
#!/usr/bin/env bash
set -eux -o pipefail
tarflags=--strip-components=2
# --wildcards required on linux but not osx
if [ "$(uname)" == "Linux" ]; then
tarflags+=--wildcards
fi
curl -sL https://api.github.com/repos/OWNER/REPO/tarball | \
tar xz $tarflags "*/SUBDIR/*"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.