Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Download github release with curl

Tags:

github

curl

On this URL I'm able to download a .tar.gz which contains an official release. (I know it's also available on an API endpoint but this contains the test package too.

Now I'm wondering why this isn't working:

$ curl -O https://github.com/yarnpkg/yarn/releases/download/v0.23.4/yarn-v0.23.4.tar.gz 

I get some .tar.gz which is 4KB instead of 3.6MB. It isn't showing an error. What am I missing? I want to use this URL and not the API if that's possible.

like image 352
DenCowboy Avatar asked Sep 05 '17 16:09

DenCowboy


People also ask

How do I pull latest release from GitHub?

On GitHub.com, navigate to the main page of the repository. To the right of the list of files, click Releases. To copy a unique URL to your clipboard, find the release you want to link to, right click the title, and copy the URL. Alternatively, right click Latest Release and copy the URL to share it.

How do I download with curl?

How to download a file with curl command. The basic syntax: Grab file with curl run: $ curl https://your-domain/file.pdf. Get file using ftp or sftp protocol: $ curl ftp://ftp-your-domain-name/file.tar.gz.

How do I download a repository from GitHub?

When downloading materials to your laptop, it is easiest to download the entire repository. To do this, go to the GitHub page for the workshop, click on the green Code button, then download the repository as a ZIP file.


1 Answers

If you do the following it will download correctly:

wget https://github.com/yarnpkg/yarn/releases/download/v0.23.4/yarn-v0.23.4.tar.gz 

If you want to use curl you have to use the redirect -L option to follow redirect link and direct the output in a file like this:

curl -L https://github.com/yarnpkg/yarn/releases/download/v0.23.4/ya‌​rn-v0.23.4.tar.gz > yarn.tar.gz 
like image 191
a.walker Avatar answered Oct 12 '22 06:10

a.walker