« Back to Index

Download a single file from a private GitHub repo. You’ll need an access token as described in this GitHub Help article: https://help.github.com/articles/creating-an-access-token-for-command-line-use

View original Gist on GitHub

GitHub curl.sh

curl --header 'Authorization: token INSERTACCESSTOKENHERE' \
     --header 'Accept: application/vnd.github.v3.raw' \
     --remote-name \
     --location https://api.github.com/repos/owner/repo/contents/path

# Example...

TOKEN="INSERTACCESSTOKENHERE"
OWNER="BBC-News"
REPO="responsive-news"
PATH="scripts/build/tabloid.sh"
FILE="https://api.github.com/repos/$OWNER/$REPO/contents/$PATH"

curl --header 'Authorization: token $TOKEN' \
     --header 'Accept: application/vnd.github.v3.raw' \
     --remote-name \
     --location $FILE

options.md