How do I get the creator of a file using the Github API? #24689
-
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! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Hi @mkay581, This API supports the same qualifiers as GitHub.com. 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: https://developer.github.com/v3/search/#search-commits That endpoint has an author email and committer email qualifier that might be helpful: https://help.github.com/en/articles/searching-commits#search-by-author-or-committer |
Beta Was this translation helpful? Give feedback.
-
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? 🤔 |
Beta Was this translation helpful? Give feedback.
-
Hey @mkay581, You can try:
for example: https://api.github.com/repos/atom/atom/commits 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
For example, using
Example results:
|
Beta Was this translation helpful? Give feedback.
-
Doesn’t this tell you who was the first user to commit anything to the repo, not who first committed a given file in the repository? |
Beta Was this translation helpful? Give feedback.
Hey @mkay581,
You can try:
for example:
https://api.github.com/repos/atom/atom/commits
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
andREPO
variablesFor example, using
SuperDevs/RepoForTestOne
it would be: