Did you know you can upload images (and other static files) to a gist simply because it’s a Git repository?
First you need to make sure you’re logged in to your GitHub account.
- Create or find a gist that you own.
Clone your gist (replace
<hash>with your gist’s hash):
# with ssh git clone email@example.com:<hash>.git mygist # or with https git clone https://gist.github.com/<hash>.git mygist
Change to your gist’s directory:
Add and commit the image:
git add image.jpg git commit -m "Add image to gist"
git push origin master
And voilà you can view the image in your gist:
If you inspect the Raw file, you’ll get something like the following:
One disadvantage of gist is it doesn’t support directories. This means all files live in the root folder of the repository.