saltycrane saltycrane - 1 year ago 144
Linux Question

How do I download a tarball from GitHub using cURL?

I am trying to download a tarball from GitHub using cURL, but it does not seem to be redirecting:

$ curl --insecure
<html><body>You are being <a href="">redirected</a>.</body></html>

Note: wget works for me:

$ wget --no-check-certificate

However I want to use cURL because ultimately I want to untar it inline with something like:

$ curl --insecure | tar zx

I found that the URL after redirecting turned out to be, but I would like cURL to be smart enough to figure this out.

Answer Source

Use the -L option to follow redirects:

curl -L | tar zx
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download