git - 有没有办法以编程方式获取私有(private) github repo 的 zipball?

标签 git oauth github repository

我们需要获取一个私有(private)仓库的 zipball。对于公共(public)的,通过 GitHub API 或手动 (https://github.com/user/repo/zipball/master) 非常容易。但是私有(private) repo 呢?即使拥有 oAuth token ,如何做也不是很明显。

最佳答案

新选择

因为给定的已接受答案不再有效,我想我会解释我是如何使用 github API 中的新更改来做到这一点的。

新的下载 Api 链接

首先,我在这里找到了有关下载存档的信息: https://developer.github.com/v3/repos/contents/#get-archive-link

公共(public) repo

如果它是一个公开的 repo 那么它就很容易......你可以这样做:

curl -L https://api.github.com/repos/pengwynn/octokit/tarball > octokit.tar.gz

私有(private) repo

如果它是私有(private)仓库,您需要通过转到您的设置然后选择“开发人员设置”/“Personal access tokens”来创建一个 oAuth token 。 我创建了一个个人 token 。

然后使用下一页上的说明,我找到了如何获取您有权访问的私有(private)存储库: https://developer.github.com/v3/#authentication

完整代码

curl -H "Authorization: token ab499f3b..." \
-L https://api.github.com/repos/godzilla/my_priv_repo/tarball > wut.tar.gz

请务必将 ab499f3b... 替换为您的实际 token 。

关于git - 有没有办法以编程方式获取私有(private) github repo 的 zipball?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9504791/

相关文章:

github 操作 : how to check if current push has new tag (is new release)?

git - 如何在 SourceTree 中正确地 rebase ?

azure - 通过 azure 应用程序服务部署时,应用程序未加载

git - 如何整合Git + Github + Google Drive?

java - 使用基于 sign-post api 的 grails-oauth 插件刷新 Yahoo Oauth 访问 token

oauth - OAuth 2.0 登录的正确注销流程是什么

authentication - 如何在表单例份验证中使用 OAuth

git - 如何从 Git Bash 在 Notepad++ 中打开文件?

git - 撤消不良 pull

git - "git init"失败,怎么了?