Created
January 26, 2019 14:31
-
-
Save afirth/aef8aebb828cabdb48ae899ff82eb36b to your computer and use it in GitHub Desktop.
save a subpath of a github repository
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 | |
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