The way to upload zip(or other binary file to a branch) by API

What i am doing is to read the file as bytes and then base64 encode to a string - treat as a text file. But needadditonal work when pull branch to local folder -need base64 decode bytes and rewrite file.

If use git command to add /commit a binary(e.g zip) file and push to remote repo, then it’s the file itself as it is, no matter pull, download from webpage or download by API.

My question, is there any API endpoint to upload a binary file to remote repo with binary type content(not converted to string type?)

Many THX

:wave: hello there @fxsucks, and welcome to the GitHub Support Community!

The GitHub REST API has an endpoint for creating or updating file contents. However, the file’s content must be encoded in Base64 encoding. Beyond that, there’s no other endpoint that exposes an alternative interface for other encoding types. I hope this helps!

Thanks for the answer, Francis.