从 Private Repo 下载 Git 存档 tarball 时遇到问题 [英] Having trouble downloading Git archive tarballs from Private Repo

查看:21
本文介绍了从 Private Repo 下载 Git 存档 tarball 时遇到问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要能够在特定标签处下载我们的应用程序,但我无法为此找到可行的解决方案.下载基于 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

解决方案

对于公共 repo,你有 这个要点 列举一些例子:

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 命令,如 SO 问题git 等效于 svn export 或 github 解决方法",也在:
"使用 GitHub API 的 curl 教程.

<小时>

OP Steven Jp 报告使 curl 命令起作用:<块引用>

最终的 curl 命令看起来像这样:

curl -sL --user "${username}:${password}" https://github.com/$account/$repo/tarball/$tag_name >tarball.tar

(多行以提高可读性)

curl -sL --user "${username}:${password}"https://github.com/$account/$repo/tarball/$tag_name>tarball.tar

I need the ability to download our application at specific tags, but I am unable to find a working solution for this. Downloading tarballs based on git tag seems promising but I am unable to get it working using Curl. I have tried the following but all I get back is the source for the github 404 page.

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

解决方案

For public repo, you have this gist listing some examples:

wget --no-check-certificate https://github.com/sebastianbergmann/phpunit/tarball/3.5.5 -O ~/tmp/cake_phpunit/phpunit.tgz

For a private repo, try passing your credential information in a post directive:

wget --quiet --post-data="login=${login}&token=${token}" --no-check-certificate https://github.com/$ACCOUNT/$PRIVATE_REPO/tarball/0.2.0.257m

Or use a curl command as in SO question "git equivalent to svn export or github workaround", also explained in great details in:
"A curl tutorial using GitHub's API".


The OP Steven Jp reports having made the curl command work:

The final curl command ended up looking something like this:

curl -sL --user "${username}:${password}" https://github.com/$account/$repo/tarball/$tag_name > tarball.tar

(in multiple lines for readability)

curl -sL --user "${username}:${password}" 
  https://github.com/$account/$repo/tarball/$tag_name
  > tarball.tar

这篇关于从 Private Repo 下载 Git 存档 tarball 时遇到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆