How to add a file to a Git repository using GitHub API?

Viewed 996

It is possible to add (commit) a new file to a Git repository in a browser according to GitHub documentation.

I want to do the same in my Java application.

Where can I find GitHub API documentation for the API call that is being used here?

Here are the request data I found using Firefox:

Screenshot

Screenshot

1 Answers

For creating or updating file contents in a GitHub repo, you can use the below GitHub v3 API

PUT /repos/{owner}/{repo}/contents/{path}

The documentation of the above API can be found here.

Related