Skip to content

Instantly share code, notes, and snippets.

Forked from Integralist/GitHub
Created March 19, 2018 19:02
What would you like to do?
Download a single file from a private GitHub repo. You'll need an access token as described in this GitHub Help article:
curl --header 'Authorization: token INSERTACCESSTOKENHERE' \
--header 'Accept: application/vnd.github.v3.raw' \
--remote-name \
# Example...
curl --header 'Authorization: token $TOKEN' \
--header 'Accept: application/vnd.github.v3.raw' \
--remote-name \
--location $FILE
  • -H --header Extra header to use when getting a web page. You may specify any number of extra headers

  • -O --remote-name Write output to a local file named like the remote file we get (only the file part of the remote file is used, the path is cut off)

  • -L --location If the server reports that the requested page has moved to a different location (indicated with a Location: header and a 3XX response code), this option will make curl redo the request on the new place

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