问题
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?
回答1:
$ curl -LOk https://github.com/ziyaddin/xampp/archive/master.zip % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 119 100 119 0 0 375 0 --:--:-- --:--:-- --:--:-- 388 0 0 0 1706 0 0 1382 0 --:--:-- 0:00:01 --:--:-- 333k
- you must use
https://
- you must use
-L
to follow redirects - you must use
-k
if your certificate file is missing
回答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 anyk
- use an insecure SSL connection without checking the TLS cert.
回答3:
$ 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...
来源:https://stackoverflow.com/questions/16261100/cant-download-github-project-with-curl-command