3

I have a .json file in Github(public) i would like to write into the json file , How should I do it ?

Comments
  • 8
    Open the file in write mode and write into it
  • 1
    @100110111 sorry , how do I use POST request to write it ? Using PHP or python ...
  • 2
  • 1
    @100110111 because myclient want it this way , in the android app they want it display and write the json value . from github repo
  • 9
    @johnmelodyme ...

    Idk, either I’m missing something here or this sounds just plain stupid. Tell ur client to shoot themselves in the face, mmkay?

    (sorry I can’t be of any real assistance here...)
  • 7
    You can’t write directly to a GitHub repo through a post request over web. There are multiple security reasons this isn’t possible or shouldn’t be done. Your best shot would be to download the got repo with an ssh key, modify it and push it.
  • 1
    is there other way without using github ? (Besides using droplets or heroku, yeap my client is stupid, they are hard headed. plus this freelancing is slowly pissing me off)
  • 1
    @100110111 Ok, thanks tho, at least you tried your best. I agree with you. probably I need to tell them it is impossible
  • 2
    @johnmelodyme Are you using PHP and Python for your Android app...?
  • 1
  • 2
    @ScriptCoded Client requested. Not my idea...
  • 6
    GIT hub uses git. Just make a commit and push it?
  • 1
  • 2
    If there is a backend u might wanna tell ur client to use stuff for what it's for because they seem to have all the pieces of this puzzle.
  • 1
    @wiwe2210 any advice on convince a stubborn client? Like I really just want to use Digital Ocean.
  • 3
    Is he trying to use git as a database? Wtf is the point... At that point he might as well use a google excel sheet...
  • 2
    @Hazarth hahaha.... Idk... Too that want it to use GitHub as RestApi and database thingy.
  • 2
    @johnmelodyme
    Do they provide you with any other server? Or is this like a website/app that's trying to be completely serverless other than the jsons on git?

    Can't you maybe use firebase? I think It's free for some limited throughput and can be used as a database somehow apparently
  • 2
    @Hazarth they don't want firebase either... They just give me a link to GitHub which is a raw....JSON.
  • 2
    @Hazarth they are weird I know.
  • 2
    @johnmelodyme

    at this point your best bet would be to find a reason why *not* using git would save the client money. That's the only thing they listen to...

    one of the reasons might be that git isn't supposed to be used for this... and not only will this take you much longer than setting up a proper document database or a simple backend but any other devs he'll ever need will have to re-learn something strange and unusual

    another reason might be that github is not under his or your control, if they have a leak, if they are down or if they decide to suddenly remove old repos or something, it's suddenly his problem as well...

    another one is that if he wants to scale his app/site he'll soon be limited by the max response time and availability of github services... you can't forexample suddenly funnel thousands of connections to github from your app, that's gonna trigger some limits and affect availability and thus earnings...
  • 1
    @Hazarth this make sense...
  • 2
    @johnmelodyme and hey, if you can’t reason with your client, drop them.
  • 1
    Change the client.

    You may or may not be able to make him happy this time and he may or may not pay good. But the emotional stress of dealing with idiots will eat your brain in the long run. So run away while you still think that his ideas are stupid...
  • 1
  • 2
    git add yourfile.json
    git commit -m "I'm a noob"
    git push
  • 2
    How about GitHub's Git Database Api: https://docs.github.com/en/rest/...
  • 2
    I made a client-side CMS using it (and Netlify Git Gateway).
  • 4
    For once, use Git Push
    For Regular updates using script, Use GitHub API
  • 2
    @johnmelodyme that's the most ridiculous use case for github I've ever heard of.
  • 2
    Pretty sure this is a github TOS violation. Github is not meant to be used like this. Check the TOS, and tell your client, the service might be shutdown by Github, of he does this.

    Your best bet, is a simple Node.js app coupled with an s3 bucket that can accept json, store it, and return it as required.
  • 2
    ITS A TRAP
  • 1
    I don't want to pay for a backend solutions ... But I don't have a choice if i want writings up from api endpoint
Add Comment