-
Create a gist if you haven't already.
-
Clone your gist:
# make sure to replace `<hash>` with your gist's hash git clone https://gist.github.com/<hash>.git # with https git clone git@gist.github.com:<hash>.git # or with ssh
-
Add your image to your gist's repository:
git add your-image.jpg
-
Commit the image:
git commit -m "Add image"
-
Update gist:
git push origin master
Forked from remarkablemark/how-to-add-image-to-gist.md
Created
January 31, 2017 14:59
-
-
Save mroderick/1afdd71aa69f6b29601d335751a1a9be to your computer and use it in GitHub Desktop.
How to add an image to a gist
I kept having weird auth issues with https. When it would try to auth me with Github in the browser, I would just get a 404.
I switched to ssh (fyi you must create an ssh key and add the public key to Github settings), remembering to change the repo remote, e.g.
git remote set-url --push origin git@github.com:<some_gist_hash>.git
This worked, and I was able to commit and push images to the gist repo.
If you get an error saying:
error: src refspec master does not match any
error: failed to push some refs to 'https://gist.github.com/<hash>.git'
Since your repository has a branch named "main", you should push your changes to that branch instead of "master". To push to the "main" branch, use the following command:
git push origin main
This command will push the changes in your local "main" branch to the remote repository.
^ Agreed, change from git push origin master
to git push origin main
.
The command with ssh is:
git clone git@github.com:HASH.git
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you cannot be serious.... 💀💀💀💀