0

how do I upload files on github in an existing repo with github api, I mean I'm able to create a repo using github api but I don't know how do I upload file via gh api?

Comments
  • 1
    The dumb way would be using a controlled chromium and uploading it that way.

    The smartest move, however, would be RTFM annd check if there is an endpoint.
  • 2
    git push?
  • 3
  • 1
  • 0
    when you are hosting a site from github on netlify it show us a popup after pressing the github button and it fetch all github information such as repos of a authenticated user how netlify do this i want to implement something like this in my application would anybody know about it if yes then please help me.
  • 0
    @priyanshu-zeon dude. Get on researching.

    If you wanna do Action A, research what do you need for research A. If you need github tokens, make a oauth thing
  • 0
    @melezorus34 I researching the past 2 days and I already solve my couple of problems in my project but when I solve a problem I face a new problem much harder than the previous one and this is the first time that I'm using github api and I generally don't ask a question I always like to research by my self when I face a problem, to be honest I'm pretty tired now and I have to submit my problem in hackathon within 8 hours that's why I keep asking questions.
  • 2
    I don't know shit about the GH API but I'm assuming that's not part of GitHub's responsibility and therefore won't be available using GH API.

    Remember, GitHub hosts git repositories, not files. The real way to do it is almost certainly to create a file, add it to the git repo, and then push that git repo by adding your github source as a remote.

    Remember, if you were just able to "upload" a file, what branch would it go to? What commit ID? What would the commit message be?

    It all seems like you've got your eyes in the wrong spot here.
Add Comment