Skip to content

Instantly share code, notes, and snippets.

@madrobby
Created March 10, 2014 23:34
Show Gist options
  • Select an option

  • Save madrobby/9476733 to your computer and use it in GitHub Desktop.

Select an option

Save madrobby/9476733 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
curl -H 'Authorization: token INSERTACCESSTOKENHERE' -H 'Accept: application/vnd.github.v3.raw' -O -L https://api.github.com/repos/owner/repo/contents/path
@cristiroma
Copy link

@W1BTR You need to pay attention to the token scope, if the repository is on another organisation repo, when you generate the PAT choose that organisation instead of your own GH account.

I had the same issue and re-created the token on the correct organization. The URL is fine. Also one must use Accept: application/vnd.github.raw+json for RAW file content.

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