C
C
ChertyakaNUB2020-11-24 18:52:48
PHP
ChertyakaNUB, 2020-11-24 18:52:48

How to upload a file to a github repository using the Github REST API?

Hi everybody!

How to upload a file to a github repository using the Github REST API?

I look at the docks, everywhere how to create, how to update is, but how to make an upload is nowhere to be found.

Can anyone tell me how to download? Are there any examples? CURL/PHP

Thank you

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
ChertyakaNUB, 2020-11-24
@ChertyakaNUB

Decision:

curl -i -X PUT -H 'Authorization: token xxxxxxxxxxxxxxxxxxxxxxxxxxx' -d
'{"message": "uploading file",
"content": base64_encode(FILE)
}' https://api.github.com/repos/{USER}/{REPO}/contents/file.ext

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question