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

@vijeth-aradhya vijeth-aradhya commented Mar 11, 2017

Thanks a lot! 😄

@RusticFlare

This comment has been minimized.

Copy link

@RusticFlare RusticFlare commented May 8, 2017

Thank you 👍

@RobertoPrevato

This comment has been minimized.

Copy link

@RobertoPrevato RobertoPrevato commented May 10, 2017

Thanks! 👍

@kruncher

This comment has been minimized.

Copy link

@kruncher kruncher commented May 10, 2017

Thanks! 👍

@getsomecoke

This comment has been minimized.

Copy link

@getsomecoke getsomecoke commented Jun 24, 2017

Thanks #

@ugumerie

This comment has been minimized.

Copy link

@ugumerie ugumerie 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

@ibrahim5253 ibrahim5253 commented Jul 10, 2017

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

@yh2n

This comment has been minimized.

Copy link

@yh2n yh2n 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

@Aneesh540 Aneesh540 commented Jul 22, 2017

👍 😃

@aabenitez

This comment has been minimized.

Copy link

@aabenitez aabenitez commented Aug 25, 2017

Excelent! It works..

@IskanderIV

This comment has been minimized.

Copy link

@IskanderIV IskanderIV commented Oct 3, 2017

Thks a LOT!!!

@yomexzo

This comment has been minimized.

Copy link

@yomexzo yomexzo commented Oct 23, 2017

Thank you! 😄

@iammart

This comment has been minimized.

Copy link

@iammart iammart commented Jan 5, 2018

This was really useful, thanks for sharing 👍

@xu-song

This comment has been minimized.

Copy link

@xu-song xu-song commented Jan 20, 2018

gist does not support directories. ... not happy

@cbcunc

This comment has been minimized.

Copy link

@cbcunc cbcunc commented Mar 14, 2018

Superb.

@821jieun

This comment has been minimized.

Copy link

@821jieun 821jieun commented Apr 2, 2018

thank you :)

@SHADOWELITE7

This comment has been minimized.

Copy link

@SHADOWELITE7 SHADOWELITE7 commented May 8, 2018

thanks, this really helps me alot

@companje

This comment has been minimized.

Copy link

@companje companje commented Jun 20, 2018

thanks!

@angusgrant

This comment has been minimized.

Copy link

@angusgrant angusgrant 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

@xurizaemon xurizaemon 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

@GUIEEN GUIEEN commented Jan 10, 2019

Thanks :)

@philshem

This comment has been minimized.

Copy link

@philshem philshem 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

@aslafy-z

This comment has been minimized.

Copy link

@aslafy-z aslafy-z commented Mar 20, 2020

I found another way without the need of a Git client:

  • Save your gist
  • Add your image to a draft comment
  • Copy the resulting markdown
  • Edit your gist and add a markdown file
  • Paste the image as markdown inside
@vaimalaviya1233

This comment has been minimized.

Copy link

@vaimalaviya1233 vaimalaviya1233 commented Dec 31, 2020

i have a question instead of picture can i add .zip file which is less than 5-10MB?

@xurizaemon

This comment has been minimized.

Copy link

@xurizaemon xurizaemon commented Dec 31, 2020

@vaimalaviya1233 You should try it on a gist of your own and find out! If that doesn't work, you can download a gist as a zip file - so you might use that to share a set of files, with some limitations (eg if you don't need a directory structure in the zip). Good luck!

@vaimalaviya1233

This comment has been minimized.

Copy link

@vaimalaviya1233 vaimalaviya1233 commented Dec 31, 2020

You should try it on a gist of your own and find out! If that doesn't work, you can download a gist as a zip file - so you might use that to share a set of files, with some limitations (eg if you don't need a directory structure in the zip). Good luck!

Thaks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment