How do I get the creator of a file using the Github API?

Hello! I am using the [Repo Commits API](http://The%20Repo Commits API) to get a list of commits. How do I find out the github user who first committed the file (the creator)?  Thanks in advance!

Hi @mkay581,

This API supports the same qualifiers as To learn more about the format of the query, we recommend checking out these guides:

If it helps, we also expose an API for searching commits:

That endpoint has an author email and committer email qualifier that might be helpful:

Thanks for the information and this is slightly helpful but still doesn’t answer my question. How would I find the creator of a file by using the Search API to search commits? Or am I missing something? :thinking:

Hey @mkay581,

You can try:

GET /repos/:owner/:repo/commits

for example:

Whereas, the first committer is Lee Dohm.

Or, on GitHub enterprise:

Use the Commits API to list committer information for the first commit.

Be sure to adjust the ORG and REPO variables 

curl -u LOGIN:TOKEN https://HOSTNAME/api/v3/repos/ORG/REPO/commits | jq '[last(.[])] | .[] | .committer.login, .committer.html_url'

For example, using SuperDevs/RepoForTestOne it would be:

curl -u LOGIN:TOKEN https://HOSTNAME/api/v3/repos/SuperDevs/RepoForTestOne/commits | jq '[last(.[])] | .[] | .committer.login, .committer.html_url'

Example results:

testone <------------- The login of the user who made the first commit on the repository.

1 Like