【发布时间】:2018-12-03 05:52:47
【问题描述】:
我正在尝试使用 curl 从 github 存储库下载 tar.gz 文件,但它显然是在下载纯 ASCII 码,因此我无法解压缩或解压缩文件(如 file 命令所证明的那样 - 请参阅下面是我的堆栈跟踪的第三行)。
另一个重要细节是它在 AWS CodeBuild 实例中运行。但是,我可以在我的 mac 上使用 curl 下载它,它是一个正确的 tar.gz 文件。
这是我正在运行的命令:
curl -Lk0s https://github.com/gohugoio/hugo/releases/download/v0.49/hugo_0.49_Linux-64bit.tar.gz -o /tmp/hugo.tar.gz
完整的堆栈跟踪是:
[Container] 2018/12/03 05:39:44 Running command curl -Lk0s https://github.com/gohugoio/hugo/releases/download/v0.49/hugo_0.49_Linux-64bit.tar.gz -o /tmp/hugo.tar.gz
[Container] 2018/12/03 05:39:45 Running command file /tmp/hugo.tar.gz
/tmp/hugo.tar.gz: ASCII text, with no line terminators ***[NB. This is the output of the file command]***
[Container] 2018/12/03 05:39:45 Running command tar xvf /tmp/hugo.tar.gz -C /tmp
tar: This does not look like a tar archive
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
[Container] 2018/12/03 05:39:45 Command did not exit successfully tar xvf /tmp/hugo.tar.gz -C /tmp exit status 2
[Container] 2018/12/03 05:39:45 Phase complete: INSTALL Success: false
[Container] 2018/12/03 05:39:45 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: tar xvf /tmp/hugo.tar.gz -C /tmp. Reason: exit status 2
我在这里做错了什么?
【问题讨论】:
-
我相信你想要大写 O,
curl -O <filename>。它当前正在从 curl 输出整个响应,而不是正在下载的文件。看看小O和大Ocurl.haxx.se/docs/manpage.html -
检查文件内容。可能是 500 错误或类似的错误。