Jos*_*rce 5 curl wget github travis-ci docker
目标:在Docker Build Script中下载github release tar.gz,以便发布文件可用于docker镜像.我不希望下载完整的源代码,我可以使用标记通过归档路径下载,而是作为发布版本的一部分构建工件.
要注意:这是从私有存储库下载的,这就是为什么我试图将github_token作为命令的一部分发送到目前为止.
问题:我在使用wget下载github版本tar.gz时遇到问题.
wget --header="Authorization: token <GITHUB_TOKEN>" --output-document=<FILENAME>.tar.gz https://github.com/<USER>/<REPO>/releases/download/<TAG>/<FILENAME>.tar.gz
Run Code Online (Sandbox Code Playgroud)
这将返回以下错误:
--2014-12-02 16:19:25-- https://github.com/<USER>/<REPO>/releases/download/<TAG>/<FILENAME>.tar.gz
Resolving github.com (github.com)... 192.30.252.131, 192.30.252.131
Connecting to github.com (github.com)|192.30.252.131|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2014-12-02 16:19:25 ERROR 404: Not Found.
Run Code Online (Sandbox Code Playgroud)
值得注意的是,我不反对使用curl进行下载,或者在必要时使用其他解决方案.
您可以使用 GitHub API。
要使用 wget 下载版本,您可以执行以下操作:
wget --header "Authorization: token <GITHUB TOKEN>" --output-document=<RELEASE>.tar.gz https://api.github.com/repos/<USER>/<REPO>/tarball/<RELEASE NAME>
Run Code Online (Sandbox Code Playgroud)
使用可以更改tarball
为zipball
以获取 zip 文件。
小智 0
该release.tar.gz
部分是由所有者设置的,因此它不是通用的。
$ wget https://github.com/XhmikosR/notepad2-mod/releases/download/4.2.25.935/Notepad2-mod.4.2.25.935.exe --2014-12-02 11:16:42-- https://github.com/XhmikosR/notepad2-mod/releases/download/4.2.25.935/Notepad2-mod.4.2.25.935.exe 正在解析 github.com (github.com)...192.30.252.130 正在连接 github.com (github.com)|192.30.252.130|:443...已连接。 HTTP 请求已发送,正在等待响应... 302 发现
归档时间: |
|
查看次数: |
2586 次 |
最近记录: |