我需要能够在特定标签下载我们的应用程序,但我无法为此找到有效的解决方案.基于git标签下载tarball看起来很有希望,但我无法使用Curl工作.我尝试了以下内容,但我得到的所有内容都是github 404页面的源代码.
curl -sL https://github.com/$ACCOUNT/$PRIVATE_REPO/tarball/0.2.0.257m?login=$MY_USER_NAME&token=$MY_TOKEN > 0.2.0.257m.tar
Run Code Online (Sandbox Code Playgroud)
Von*_*onC 28
对于公共回购,你有这个要点列举一些例子:
wget --no-check-certificate https://github.com/sebastianbergmann/phpunit/tarball/3.5.5 -O ~/tmp/cake_phpunit/phpunit.tgz
Run Code Online (Sandbox Code Playgroud)
对于私人仓库,请尝试在post指令中传递凭证信息:
wget --quiet --post-data="login=${login}&token=${token}" --no-check-certificate https://github.com/$ACCOUNT/$PRIVATE_REPO/tarball/0.2.0.257m
Run Code Online (Sandbox Code Playgroud)
或者使用curl命令,如SO问题" git equivalent to svn exportor github workaround ",还详细解释了:
" 使用GitHub API的卷曲教程 ".
该OP史蒂芬太平绅士报告作出的curl命令工作:
最后的curl命令最终看起来像这样:
curl -sL --user "${username}:${password}" https://github.com/$account/$repo/tarball/$tag_name > tarball.tar
Run Code Online (Sandbox Code Playgroud)
(为了便于阅读,多行)
curl -sL --user "${username}:${password}"
https://github.com/$account/$repo/tarball/$tag_name
> tarball.tar
Run Code Online (Sandbox Code Playgroud)
tja*_*nez 15
创建访问令牌后,
你可以使用wget:
wget --output-document=<version>.tar.gz \
https://api.github.com/repos/<owner>/<repo>/tarball/<version>?access_token=<OAUTH-TOKEN>
Run Code Online (Sandbox Code Playgroud)
或者curl:
curl -L https://api.github.com/repos/<owner>/<repo>/tarball/<version>?access_token=<OAUTH-TOKEN> \
> <version>.tar.gz
Run Code Online (Sandbox Code Playgroud)
有关更多信息,请参阅GitHub的归档链接API参考.