Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

How to add an image to a gist

  1. Create or find a gist that you own.

  2. Clone your gist (replace <hash> with your gist's hash):

    # with ssh
    git clone git@gist.github.com:<hash>.git mygist
    
    # with https
    git clone https://gist.github.com/<hash>.git mygist
  3. Change to your gist’s directory:

    cd mygist
  4. Add and commit the image:

    git add tulip.jpg
    git commit -m "Add tulip to gist"
  5. Update remote:

    git push origin master

See blog post.

@vijeth-aradhya

This comment has been minimized.

Copy link

commented Mar 11, 2017

Thanks a lot! 😄

@RusticFlare

This comment has been minimized.

Copy link

commented May 8, 2017

Thank you 👍

@RobertoPrevato

This comment has been minimized.

Copy link

commented May 10, 2017

Thanks! 👍

@kruncher

This comment has been minimized.

Copy link

commented May 10, 2017

Thanks! 👍

@getsomecoke

This comment has been minimized.

Copy link

commented Jun 24, 2017

Thanks #

@ugumerie

This comment has been minimized.

Copy link

commented Jul 3, 2017

How did you add the image? Because after the cloning, I manually added the image to the repo folder created after the clone. When I try to add the image I would get an error saying fatal: pathspec 'CustomCheckbox.JPG' did not match any files Am new to this. Thank you

@ibrahim5253

This comment has been minimized.

Copy link

commented Jul 10, 2017

It reorders the images in my case. But thanks anyway.

@yh2n

This comment has been minimized.

Copy link

commented Jul 18, 2017

Thanks!
@ugumerie: Before adding the image to your repo, drag and drop the picture into the folder you cloned.

@Aneesh540

This comment has been minimized.

Copy link

commented Jul 22, 2017

👍 😃

@aabenitez

This comment has been minimized.

Copy link

commented Aug 25, 2017

Excelent! It works..

@IskanderIV

This comment has been minimized.

Copy link

commented Oct 3, 2017

Thks a LOT!!!

@yomexzo

This comment has been minimized.

Copy link

commented Oct 23, 2017

Thank you! 😄

@iammart

This comment has been minimized.

Copy link

commented Jan 5, 2018

This was really useful, thanks for sharing 👍

@xu-song

This comment has been minimized.

Copy link

commented Jan 20, 2018

gist does not support directories. ... not happy

@cbcunc

This comment has been minimized.

Copy link

commented Mar 14, 2018

Superb.

@821jieun

This comment has been minimized.

Copy link

commented Apr 2, 2018

thank you :)

@SHADOWELITE7

This comment has been minimized.

Copy link

commented May 8, 2018

thanks, this really helps me alot

@companje

This comment has been minimized.

Copy link

commented Jun 20, 2018

thanks!

@unmem

This comment has been minimized.

Copy link

commented Jun 22, 2018

sweet

@unmem

This comment has been minimized.

Copy link

commented Jun 22, 2018

btw, how could you post reply with image, for example https://gist.github.com/justintv/168835#gistcomment-1717504
Just drag & drop image here ...

@angusgrant

This comment has been minimized.

Copy link

commented Aug 28, 2018

Hi can some one advise how I clone the following gist repo. https://gist.github.com/angusgrant/8599b573d600539f192d9c5709bc1e6e.
I try this git clone git@gist.github.com:8599b573d600539f192d9c5709bc1e6e.git mygist but I get error message:
git@gist.github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please advise I'm new to github/gist. thanks.

@xurizaemon

This comment has been minimized.

Copy link

commented Nov 6, 2018

@angusgrant Github's SSH setup docs are at https://help.github.com/articles/connecting-to-github-with-ssh/ - once you have SSH set up, gist and github should both work the same.

@GUIEEN

This comment has been minimized.

Copy link

commented Jan 10, 2019

Thanks :)

@philshem

This comment has been minimized.

Copy link

commented May 14, 2019

@xurizaemon @angusgrant

@angusgrant Github's SSH setup docs are at https://help.github.com/articles/connecting-to-github-with-ssh/ - once you have SSH set up, gist and github should both work the same.

FWIW, for me, github was always working fine, but I had a similar error message when I did my first push. Because I have TFA with my login, I had to use my username and token (not password). Once I did that one time, my ssh key was correctly used subsequent times.

https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.