curl - How can I download a single raw file from a private github repo using the command line? -
on ci server, want fetch config file maintain on github can shared between many jobs. i'm trying file via curl, these approaches both fail (i 404):
# advised oauth docs curl -h 'authorization: token the_token' -l -o setup.sh https://raw.github.com/org/repo/file # url of raw file after clicking view curl -l https://raw.github.com/org/repo/file?login=username&token=the_token
the previous answers don't work (or don't work anymore).
you can use v3 api raw file (you'll need oauth token):
curl -h 'authorization: token insertaccesstokenhere' -h 'accept: application/vnd.github.v3.raw' -o -l https://api.github.com/repos/owner/repo/contents/path
all of has go on 1 line. -o option saves file in current directory. can use -o filename specify different filename.
to oauth token follow instructions here: https://help.github.com/articles/creating-an-access-token-for-command-line-use
i've written gist well: https://gist.github.com/madrobby/9476733
edit: api references solution follows:
Comments
Post a Comment