简体   繁体   English

如何使用 wget/curl 从 GitHub 企业存储库下载发布工件?

[英]How do I download release artifacts from a GitHub enterprise repository using wget/curl?

I am working on a repository in GitHub enterprise ;我正在GitHub 企业中的存储库上工作; I have created a 1.0.0 release for my project, mycoolrepo .我为我的项目mycoolrepo创建了一个1.0.0版本。

How can I download the release zip artifact with ?如何下载带有的发布 zip 工件?

From the documentation , you must hit:文档中,您必须点击:

/repos/{owner}/{repo}/tarball/{ref}

First of all, create a GitHub token with the necessary read permissions.首先,创建一个具有必要读取权限的 GitHub 令牌。

Then, if we say that:那么,如果我们这样说:

  • {owner} is paolo {owner} 是paolo
  • {repo} is mycoolrepo {repo} 是mycoolrepo
  • {ref} is 1.0.0 {ref} 是1.0.0

then you can use:那么你可以使用:

$ curl -s -L -H "Authorization: token INSERT_TOKEN_HERE" https://github.MY_ENTERPRISE_NAME.com/api/v3/repos/paolo/mycoolrepo/tarball/1.0.0 --output release_zip

obviously, replace INSERT_TOKEN_HERE and MY_ENTERPRISE_NAME with the token and the organisation name respectively.显然,将INSERT_TOKEN_HEREMY_ENTERPRISE_NAME分别替换为令牌和组织名称。

You can confirm the download has been successful with file ;您可以通过file确认下载已成功; for a successful download, it should look as follows:要成功下载,它应该如下所示:

$ file release_zip
release_zip: gzip compressed data, from Unix, original size 51200

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

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