2 min read

Upload gifs to github gists

You may not know this, but gist's on GitHub are actually complete git repositories. The gist interface is meant to simplify them for small one-off files or collections, something akin to Pastebin, but backed by git.

As a result, you can upload any file you want to a gist, just like you can with github, it just requires you to clone the repository, add the file, and push to the repository.

To celebrate GitHub's new "pinned" repositories and gists, I'll walk you through adding a gif so you can pin it to your profile.

First, create a gist with a stub file, we'll delete this file later on so you can name it whatever you want. Remember to make the gist public!

Next, clone the repository onto your local machine. By default, the clone button is set to "Embed" so it's a bit hidden. You'll want to select either Clone via HTTPS or Clone via SSH depending on your system, if you don't know then you probably want HTTPS.

Now to do the clone, by default, it'll clone with a horribly long SHA as the directory name but I'll change it to something easier to work with. I'll do the next steps via the command line but you can follow along with a gui if you'd prefer.

Now we can go into the directory, you simply want to delete the stub file we made and add your gif file, then commit the changes. You should end up with just a gif in the repository and no uncommitted changes.

Above you can see me checking the repository status, adding all the changes to the stage, and committing the changes. Now we've got that done, we can push the changes, this will upload the changes to your gist.

Now lets go and check the result on our gist.

Great, the gif is there and we have no other files, this is perfect for what we need! Now for the last step, go back to your github profile and change your pinned projects to include the gist with our gif file. This will make the gif appear on your profile.

Now we've seen how a gist is a full git repository, and how to add gifs to your github profile. Go forth and make beautiful creations!