给定一个简短的 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
您似乎只需将 ?ref=somereference 附加到您的 URL 即可使其正常工作。引用可以是 sha-hash、标签、分支...
显然有一个查询参数
ref
可以传递给url
The name of the commit/branch/tag. Default: the repository’s default branch (usually master)