Skip to content

Instantly share code, notes, and snippets.

@stujo
Forked from Integralist/GitHub curl.sh
Last active February 15, 2019 21:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stujo/db4b3a016bb2b452e289d0947dd6e9ac to your computer and use it in GitHub Desktop.
Save stujo/db4b3a016bb2b452e289d0947dd6e9ac to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash
TOKEN="INSERTACCESSTOKENHERE"
OWNER="BBC-News"
REPO="responsive-news"
FILE_PATH="scripts/build/tabloid.sh"
FILE="https://api.github.com/repos/$OWNER/$REPO/contents/$FILE_PATH"
curl --header "Authorization: token $TOKEN" \
--header 'Accept: application/vnd.github.v3.raw' \
--remote-name \
--location $FILE_PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment