-
-H --headerExtra header to use when getting a web page. You may specify any number of extra headers -
-O --remote-nameWrite 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 --locationIf 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
Created
April 2, 2018 19:38
-
-
Save joshuapekera/6ffc379124ace62745ab58121c23f70e 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
This file contains hidden or 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
| 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment