Chiranga Alwis
Chiranga Alwis

Reputation: 1101

Get details of a Git Commit using only the SHA-1 hash through the GitHub REST API or GraphQL API v4

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.

Upvotes: 3

Views: 519

Answers (1)

Bertrand Martel
Bertrand Martel

Reputation: 45352

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"

Upvotes: 2

Related Questions