Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从私人回购下载Git归档tarball时遇到问题_Git_Github - Fatal编程技术网

从私人回购下载Git归档tarball时遇到问题

从私人回购下载Git归档tarball时遇到问题,git,github,Git,Github,我需要能够下载我们的应用程序在特定的标签,但我无法找到一个有效的解决方案。基于git标签下载tarballs似乎很有希望,但我无法使用Curl让它工作。我已经尝试了以下内容,但我得到的只是Github404页面的源代码 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 对于公开回购,您列

我需要能够下载我们的应用程序在特定的标签,但我无法找到一个有效的解决方案。基于git标签下载tarballs似乎很有希望,但我无法使用Curl让它工作。我已经尝试了以下内容,但我得到的只是Github404页面的源代码

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
对于公开回购,您列出了一些示例:

wget --no-check-certificate https://github.com/sebastianbergmann/phpunit/tarball/3.5.5 -O ~/tmp/cake_phpunit/phpunit.tgz
对于私人回购,请尝试在post指令中传递凭证信息:

wget --quiet --post-data="login=${login}&token=${token}" --no-check-certificate https://github.com/$ACCOUNT/$PRIVATE_REPO/tarball/0.2.0.257m
或者使用问题“”中的curl命令,在:
“”


使
curl
命令起作用的报告:

最后一个curl命令的结果如下所示:

(为便于阅读,多行)

创建一个

您可以使用
wget

wget --output-document=<version>.tar.gz \
    https://api.github.com/repos/<owner>/<repo>/tarball/<version>?access_token=<OAUTH-TOKEN>

更多信息可在中找到。

登录Github.com上的私人组织,然后转到此处创建您的令牌:

当尝试卷曲到您的私人组织时,请使用以下方法:

curl --header 'Authorization: token ADDACCESSTOKENHERE' \
 --header 'Accept: application/vnd.github.v3.raw' \
 --remote-name \
 --location https://api.github.com/repos/ORG/PROJECT/contents/FILE

用您的信息替换CAPS中的内容…

您是否在公共回购上尝试过相同的URL方案?您是否尝试过wget?或者只是使用git从特定标记克隆代码?您的第二个链接帮助我实现了这些功能。最后一个curl命令的外观类似于
curl-sL--user“${username}:${password}”https://github.com/$account/$repo/tarball/$tag_name>tarball.tar
@Steven_JP优秀。我在答案中加入了您的命令以提高可见性。我不确定这些wget示例是否仍然有效,但这对我来说是有效的:出于某种原因,当一个标头用于auth时,我无法将多个带有curl的标头发送到Github API以下载二进制资产。它返回“只允许一个身份验证机制;只应指定X-Amz-Algorithm查询参数、签名查询字符串参数或授权标头”的XML响应。但是如果我将auth从一个header改为querystring参数,那么它就可以工作了。提到这个怪癖,您可能需要添加“--no check certificate”参数:
wget--no check certificate--output document=.tar.gzhttps://api.github.com/repos///tarball/?access_token=
wget --output-document=<version>.tar.gz \
    https://api.github.com/repos/<owner>/<repo>/tarball/<version>?access_token=<OAUTH-TOKEN>
curl -L https://api.github.com/repos/<owner>/<repo>/tarball/<version>?access_token=<OAUTH-TOKEN> \
    > <version>.tar.gz
curl --header 'Authorization: token ADDACCESSTOKENHERE' \
 --header 'Accept: application/vnd.github.v3.raw' \
 --remote-name \
 --location https://api.github.com/repos/ORG/PROJECT/contents/FILE