3

Is it possible to get details of a Git Commit using only the SHA-1 hash (without knowing the repository name and the respective branch) using the GitHub REST API or GraphQL API v4?

As per specification of GitHub's REST API, it isn't possible. Currently, I am using the GitHub GraphQL API and I have not been successful in achieving this.

Chiranga Alwis
  • 1,049
  • 1
  • 25
  • 47

1 Answers1

2

You can search commit with a specific sha using Search commit API :

curl "https://api.github.com/search/commits?q=6302aad48c5cb56c9f9c3fb7aa73d2f1f2f10540" \
     -H "Accept: application/vnd.github.cloak-preview"
Bertrand Martel
  • 42,756
  • 16
  • 135
  • 159