Download Releases from Github using Curl and Wget

This post was originally published on this site

The issue

I was trying to download a software release from GitHub using Curl and hitting an issue, the file wasn’t large enough for a start, it was unusable and clearly not the file I expected.

curl -O

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 635 100 635 0 0 2387 0 --:--:-- --:--:-- --:--:-- 2387

I tested this in a browser and found the link redirects elsewhere, hence the issue.

The Fix

Just needed to specify a few extra arguments.

curl -LJO

# Explanation of the arguments

-L, --location      Follow redirects
-J, --remote-header-name Use the header-provided filename
-O, --remote-name   Write output to a file named as the remote file

If you wish to use wget instead.

wget --content-disposition

# Explanation of the argument 
--content-disposition        honor the Content-Disposition header when choosing local file names (EXPERIMENTAL)


The post Download Releases from Github using Curl and Wget appeared first on