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 protected]:<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"
- Update remote:
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:
Note: One disadvantage of gist is it doesn’t support directories. This means all files live in the root folder of the repository.