can't download github project with curl command
Solution 1
curl -L -O https://github.com/ziyaddin/xampp/archive/master.zip
- you must use
https://
- you must use
-L
to follow redirects
Solution 2
You can also download a tarball
(*.tar.gz) with:
curl -LkSs https://api.github.com/repos/ziyaddin/xampp/tarball -o master.tar.gz
or if you use the -O
you can omit the filename, but then your saved ".tar.gz" file, is named by default to "tarball", so you have to rename it and add the ".tar.gz" filetype postfix. So use the (lowercase) -o
as above. The rest:
-
Ss
- use silent mode, but show errors, if any -
k
- use an insecure SSL connection without checking the TLS cert.
Solution 3
curl -JLO "https://github.com/tada/pljava/archive/V1_6_2.zip"
-J, --remote-header-name Use the header-provided filename (H).
-L, --location Follow redirects (H).
-O, --remote-name Write output to a file named as the remote file.
Gist Reference
Solution 4
$ curl -I http://github.com/ziyaddin/xampp/archive/master.zip HTTP/1.1 301 Moved Permanently Server: GitHub.com Date: Sun, 28 Apr 2013 09:24:53 GMT Content-Type: text/html Content-Length: 178 Connection: close Location: https://github.com/ziyaddin/xampp/archive/master.zip Vary: Accept-Encoding
... so you need to use -L
if you want to follow the HTTP redirect. Or just read Steven Penny's answer...
Solution 5
One thing not mentioned in the above answers is what if you have a really large file such that when you go to that file in a GitHub repository, you see a message that says:
(Sorry about that, but we can’t show files that are this big right now.)
To download such a large file requires adding an argument to the URL of ?raw=true
as in the following curl
command example:
curl -L https://github.com/opengenpos/buildproducts/blob/main/GenPOS_rel_02_03_01_013.exe?raw=true >jkjk.exe
This results in the following output in a Windows command shell window:
C:\Users\rickc\Documents>curl -L https://github.com/opengenpos/buildproducts/blob/main/GenPOS_rel_02_03_01_013.exe?raw=true >jkjk.exe
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 146 100 146 0 0 146 0 0:00:01 --:--:-- 0:00:01 491
100 157 100 157 0 0 157 0 0:00:01 --:--:-- 0:00:01 153k
100 15.7M 100 15.7M 0 0 15.7M 0 0:00:01 0:00:01 --:--:-- 12.7M
C:\Users\rickc\Documents>
and the file is downloaded to a local file named jkjk.exe
.
Note: Windows 10 now has both tar
and curl
as standard commands now see Tar and Curl Come to Windows!:
Beginning in Insider Build 17063, we’re introducing two command-line tools to the Windows toolchain:
curl
andbsdtar
. It’s been a long time coming, I know. We'd like to give credit to the folks who’ve created and maintainbsdtar
andcurl
— awesome open-source tools used by millions of humans every day. Let's take a look at two impactful ways these tools will make developing on Windows an even better experience.
Ziyaddin Sadigov
Updated on December 08, 2021Comments
-
Ziyaddin Sadigov over 2 years
I used "curl -sO" command to download project files from this GitHub project link: http://github.com/ziyaddin/xampp/archive/master.zip
but, I couldn't download. There is error occured and says that:
Archive: /home/ziyaddin/Desktop/master.zip [/home/ziyaddin/Desktop/master.zip] End-of-central-directory signature not found. Either this file is not a zipfile, or it constitutes one disk of a multi-part archive. In the latter case the central directory and zipfile comment will be found on the last disk(s) of this archive. zipinfo: cannot find zipfile directory in one of /home/ziyaddin/Desktop/master.zip or /home/ziyaddin/Desktop/master.zip.zip, and cannot find /home/ziyaddin/Desktop/master.zip.ZIP, period.
but I can download this link with curl command: http://cloud.github.com/downloads/pivotal/jasmine/jasmine-standalone-1.3.1.zip
I think that it is because it is in cloud.github.com. I want to know how can I download from first link with curl command?
-
ezorita over 2 yearswhy would you want to use
-k
? -
not2qubit over 2 years
-
ezorita over 2 yearsWhat libcurl is verifying is the server-side certificate. Unless you're hitting a local server with a self-signed certificate, you shouldn't be using
-k
because it makes your connection inherently insecure and vulnerable to man-in-the-middle attacks.