Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gist: How are images uploaded to a gist?

Tags:

git

github

gist

People also ask

How do I add an image to a GitHub markdown?

You can drag and drop the image from your computer to a comment field in GitHub. Wait for the file to upload and then the URL to the image is right there!

How do GitHub gists work?

Gists let you share code snippets, entire files, or even applications. You can also use gists to save and share console output when running, debugging, or testing your code. Each gist is a repository that can be cloned or forked by other people.


With a little creativity you can achieve this faster than cloning. To drag/drop:

  1. Create the Gist
  2. Drag an image into the comment field below. This will auto-upload your image file to https://user-images.githubusercontent.com and insert markdown code in the comment field to display the image.
  3. Copy this markdown code to your gist

Note: It is not required that you submit the comment.

Live example

Screenshot of comment field


I was looking for answer for the same question, here is what I just found:

  1. You can clone your gist as a git repository and add your picture, then push to origin. See loading-thumbnail-into-gist-for.

  2. There is a script written to do this: hecticjeff/gist-img.

I have not tried the above solutions yet, but pretty sure they should work. I did try using defunkt/gist to update my gist with a png but ended up displaying a binary file in my gist.


  1. Create a gist or reuse one of your gists.
  2. Clone your gist:

    git clone https://gist.github.com/<hash>.git
    
  3. Add your image to your gist's repository:

    git add my-image.jpg
    
  4. Commit the image:

    git commit -m "adding my image to my gist"
    
  5. Update gist by pushing you modifications:

    git push origin master
    

Clone gist with SSH:

$ git clone [email protected]:<hash>.git mygist

HTTP clone worked fine, but ran into HTTP authentication problems at git push.


I was looking for an answer to this same question too, in my case in order to be able to upload PDF files. I had trouble with gist-img (mentioned in another answer to this question). I searched some more and discovered gistup, which worked perfectly, the first time I tried it. It uses node and npm, so it should work on most major operating systems.


How to put images in your Gist url:

  1. upload your image to a place like imgur.com for free, then get the hot-link.
  2. Add a file and give it a markdown extension .md and use markdown image syntax:

![alt text here](https://URL)

  1. ?????
  2. Profit