I am trying to create a gist from bash, and I have tried many versions scripts I could get, but none are working.
This seems like a correct one, but it does not work also.
curl -X POST -d '{"public":true,"files":{"test.txt":{"content":"String file contents"}}}' https://api.github.com/gists
I have a test.txt
file with content I would like to create the gist, but it won't work. It says, invalid email
, if I try to add -u USER
or -u USER:PASS
it still won't work saying "message": "Problems parsing JSON",
..
I don't know what is wrong. the documentation does not provide much except for this line:
POST /gists
as you can see, I am passing the test.txt file.
Gist is an easy method to share snippets or excerpts of data with others. A gist can be a string of code, a bash script or some other small piece of data. These bits of information are hosted by GitHub as a repository.
Recently GitHub CLI released. So you can now use it instead.
Just install it to your system (https://github.com/cli/cli#installation)
The authenticate (it's pretty simple)
gh auth login
After you logged in you can simply create a new gist by:
gh gist create -d "my test gist" -f some_local_file.txt test_gist
For more details you can use help:
gh <command> <subcommand> --help
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With