我正在尝试使用cURL从GitHub下载一个tarball,但它似乎没有重定向:
$ 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适用于我:
$ wget --no-check-certificate https://github.com/pinard/Pymacs/tarball/v0.24-beta2
但是,我想使用cURL,因为最终我想用下面这样的东西来内联解压它:
$ 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足够聪明,能弄清楚这一点。
发布于 2011-04-21 23:35:18
使用-L
选项执行重定向:
curl -L https://github.com/pinard/Pymacs/tarball/v0.24-beta2 | tar zx
发布于 2014-04-19 07:46:12
实现这一目标的现代化方法是:
curl -sL https://github.com/user-or-org/repo/archive/sha1-or-ref.tar.gz | tar xz
相应地替换user-or-org
、repo
和sha1-or-ref
。
如果需要压缩文件而不是压缩文件,请指定.zip
而不是.tar.gz
后缀。
您还可以通过将-u token:x-oauth-basic
选项指定为curl来检索私有存储库的存档。用personal access token.替换token
发布于 2011-04-21 23:35:56
您还可以使用wget将其解压到内联«。只需将标准输出指定为输出文件(-O -
):
wget --no-check-certificate https://github.com/pinard/Pymacs/tarball/v0.24-beta2 -O - | tar xz
https://stackoverflow.com/questions/5746325
复制相似问题