Search code examples
githubgithub-api

how to download specific commit of the file on github


Given a short sha, I want to be able to download the file content of that commit using the github api. currently i am using following to fetch the content, and it works fine, but how can i download the content for specific 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

Solution

  • apparently there is a query parameter ref can be passed to the url

    The name of the commit/branch/tag. Default: the repository’s default branch (usually master)