restgithubgithub-apigithub-oauth

Is there a way to get binary files (contents) of Github private repositories of GitHub OAuth logged in users through Github API?


I've been looking for a way to get binary files (contents) of Github private repositories and organization repositories through GitHub API, in order to build those files and deploy them for users. (in order to create a minimized version of clone deployment service)

It seems it is able to get binary files from Github releases through Github API. However, couldn't find a way to get files (contents) of repositories (not releases).

Is there any way to get contents of Github repositories?


Solution

  • To get the content of a file (not a release), you would need to combine:

    But only if your file is less than 1MB. For larger file, you would need GraphQL.


    The OP Tae opted for, in the comments:

    just get the clone_url and then run git clone, rather than somehow getting all the blobs in order to to create directories and files again.