How to find a Github file 's SHA blob

后端 未结 3 1272
囚心锁ツ
囚心锁ツ 2021-02-05 02:46

I\'m using this API to update a file on my repo, it requires me to have a valid SHA blob for a file that I want to update:

http://developer.github.com/v3/repos/contents/

3条回答
  •  天涯浪人
    2021-02-05 03:33

    If you use GraphQL API v4, you can use the following to find the sha of a specific file :

    {
      repository(owner: "testacc01", name: "testrepo01") {
        object(expression: "master:test.txt") {
          ... on Blob {
            oid
          }
        }
      }
    }
    

    Try it in the explorer

提交回复
热议问题