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:
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.
curl -X PUT -H "Authorization: Bearer <access_token>" -H "Content-Type: application/json" -d '{"message":"Commit message","content":"<file_content>","branch":"<branch_name>"}' https://api.github.com/repos/{owner}/{repo}/contents/{path}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With