简体   繁体   English

使用部署密钥从Github存储库的发行部分下载文件

[英]Download a file from the release section of Github repo using deployment key

I use a read-only deployment key to clone a private Github repo into a Docker container. 我使用只读部署密钥将私有Github存储库克隆到Docker容器中。 However, it doesn't seem possible to use that same deployment key to download a file from a Release. 但是,似乎不可能使用相同的部署密钥从发行版下载文件。 In particular, downloading a file from a release only seems to be possible by using a personal access key. 特别是,使用个人访问密钥似乎只能从发行版下载文件。 For instance, here is one such tool to do that: 例如,这是一种用于执行此操作的工具:

https://github.com/gruntwork-io/fetch https://github.com/gruntwork-io/fetch

It seems that all of these responses focus on using personal access tokens instead of deployment keys: 似乎所有这些响应都集中在使用个人访问令牌而不是部署密钥:

How do I download binary files of a GitHub release? 如何下载GitHub版本的二进制文件?

How to download GitHub Release from private repo using command line 如何使用命令行从私有仓库下载GitHub Release

However, I have yet to see anybody indicating that it is not possible. 但是,我还没有看到有人表明这是不可能的。 So am I just missing something? 那我只是想念什么吗? Is it possible to download a file from a release (or hell.. a whole release) using a deployment key (not a personal access key)? 是否可以使用部署密钥(而不是个人访问密钥)从发行版(或整个发行版)下载文件?

I need to have a key that is not tied to one of the maintainer's user accounts and I hate the idea of creating some throw-away phantom user solely for the purpose of automating downloads. 我需要一个与维护者的用户帐户无关的密钥,并且我讨厌只为自动下载目的而创建一些一次性虚拟用户的想法。 After all, the phantom account is going to be tied to somebody's account, and I don't like the idea of that. 毕竟,虚拟帐户将与某人的帐户绑定在一起,我不喜欢这样的想法。

It's not possible to use a deployment key to download a release. 无法使用部署密钥下载发行版。 A deployment key is an SSH key, and on GitHub, SSH functionality is limited to fetching and pulling. 部署密钥是SSH密钥,在GitHub上,SSH功能仅限于获取和提取。

When you want to download an archive, fetch a raw file, or perform any other action that uses HTTPS, you need HTTPS credentials. 当您要下载档案,获取原始文件或执行其他使用HTTPS的操作时,您需要HTTPS凭据。 That can be a personal access token, or an OAuth token from an OAuth app enabled on your account. 这可以是个人访问令牌,也可以是您帐户中启用的OAuth应用中的OAuth令牌。 SSH keys can't be used for that, because they're for a different protocol. SSH密钥不能用于此目的,因为它们用于其他协议。

The way it sounds like is probably best for you is by using an OAuth application which has access to the organization's account. 听起来最适合您的方式是使用可以访问组织帐户的OAuth应用程序。 That will help avoid the problem where a particular user leaves the organization. 这将有助于避免特定用户离开组织的问题。

You could also download the repository and use git archive to produce an archive on your own (or extract just the files you want by combining it with tar ). 您还可以下载存储库,并使用git archive自己生成一个归档文件(或通过将其与tar结合仅提取所需的文件)。 That, of course, wouldn't be as efficient. 当然,这不会那么有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM