如何使用 cURL 从 GitHub 下载 tarball? [英] How do I download a tarball from GitHub using cURL?
本文介绍了如何使用 cURL 从 GitHub 下载 tarball?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 cURL 从 GitHub 下载 tarball,但似乎没有正在重定向:
I am trying to download a tarball from GitHub using cURL, but it does not seem to be redirecting:
$ curl --insecure https://github.com/pinard/Pymacs/tarball/v0.24-beta2
<html><body>You are being <a href="https://nodeload.github.com/pinard/Pymacs/tarball/v0.24-beta2">redirected</a>.</body></html>
注意:wget 对我有用:
Note: wget works for me:
$ wget --no-check-certificate https://github.com/pinard/Pymacs/tarball/v0.24-beta2
但是我想使用 cURL,因为最终我想用以下内容解压它:
However I want to use cURL because ultimately I want to untar it inline with something like:
$ curl --insecure https://github.com/pinard/Pymacs/tarball/v0.24-beta2 | tar zx
我发现重定向后的网址竟然是https://download.github.com/pinard-Pymacs-v0.24-beta1-0-gcebc80b.tar.gz,但我希望 cURL 足够聪明来解决这个问题.
I found that the URL after redirecting turned out to be https://download.github.com/pinard-Pymacs-v0.24-beta1-0-gcebc80b.tar.gz, but I would like cURL to be smart enough to figure this out.
推荐答案
使用 -L
选项跟随重定向:
Use the -L
option to follow redirects:
curl -L https://github.com/pinard/Pymacs/tarball/v0.24-beta2 | tar zx
这篇关于如何使用 cURL 从 GitHub 下载 tarball?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文