如何在github上下载文件的具体commit

问题描述 投票:0回答:2

给定一个简短的 sha,我希望能够使用 github api 下载该提交的文件内容。 目前我正在使用以下内容来获取内容,并且工作正常,但是我如何下载特定sha的内容?

curl -u 'username:password' \
-H 'Accept: application/vnd.github.v3.raw' \
-o output.yaml
-L https://mycompany/api/v3/repos/myorg/myrepo/contents/services/serviceA/helm/manifest.yaml
github github-api
2个回答
0
投票

您似乎只需将 ?ref=somereference 附加到您的 URL 即可使其正常工作。引用可以是 sha-hash、标签、分支...


-1
投票

显然有一个查询参数

ref
可以传递给url

The name of the commit/branch/tag. Default: the repository’s default branch (usually master)
© www.soinside.com 2019 - 2024. All rights reserved.