如何使用cURL从GitHub下载tarball? [英] How do I download a tarball from GitHub using cURL?

查看:396
本文介绍了如何使用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

我发现重定向后的URL是 https://download.github.com/pinard-Pymacs-v0.24-beta1

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.

推荐答案

p>使用 -L 选项跟随重定向:

curl -L https://github.com/pinard/Pymacs/tarball/v0.24-beta2 | tar zx

这篇关于如何使用cURL从GitHub下载tarball?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆