1

I'm using GitHub Enterprise and I uploaded a large binary file to the Release section of a repo. The link to the download file is https://git.mycompany.com/theuser/therepo/releases/download/0.0.1-alpha/large.file.

What's the proper way to download this file using cURL?

Every time I try to cURL the file, I get a response saying that I'm being redirected, or I get garbage back. I'm able to cURL a file that's inside the actual repo using the raw link to the file (which has a token in the URL).

I've tried various combinations of cURL against the GitHub API, and other URLs, but nothing is working.

CodeSmith
  • 2,133
  • 1
  • 20
  • 43

1 Answers1

1

Every time I try to cURL the file, I get a response saying that I'm being redirected

Make sure to use curl -L to follow redirections.

or I get garbage back

Make sure to use curl -O afile or otherwise the result of the download would be directly on stdout.

So in short

curl -L -O afile https://git.mycompany.com/theuser/therepo/releases/download/0.0.1-alpha/large.file

Or use the "Latest release asset" GitHub API, combined with this curl tutorial.

curl -vLJO -H 'Accept: application/octet-stream' 'https://api.github.com/repos/:owner/:repo/releases/assets/:id?access_token=:token'

See more at "How to download GitHub Release from private repo using command line".

If your repo is not a private one, you might not need a token access.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250