-
-
Save madrobby/9476733 to your computer and use it in GitHub Desktop.
| curl -H 'Authorization: token INSERTACCESSTOKENHERE' -H 'Accept: application/vnd.github.v3.raw' -O -L https://api.github.com/repos/owner/repo/contents/path |
I get:
curl: (6) Could not resolve host: application
{
"message": "Not Found",
"documentation_url": "https://docs.github.com/rest/repos/contents#get-repository-content",
"status": "404"
}
I'm on windows, if that makes a difference.
My command is structured as follow:
curl -H 'Fine_Grain_Auth_Token_With_Readonly_permissions' -H 'Accept: application/vnd.github.v4.raw' -L https://api.github.com/repos/MYACCOUNT/MYREPO/contents/Bin/file.txt
I am able to access the file with a url like this (when signed in)
https://raw.githubusercontent.com/MYACCOUNT/MYREPO/main/Bin/file.txt
I have also tried having the /main in the url in the command with no change.
@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.
I've created this simple gist in case someone needs to download a json file from a private repository and use it as a dictionary: https://gist.github.com/porthunt/b994154c054deeab7ab4073273aa75bc