Ian Byrd

How to get your own git.io short URL?

Just run this for any URL within GitHub and perceive instant euphoria: curl http://git.io/ --include -F url="https://github.com/<path>" -F code="<name>".


Back to 2011, in terms of a big experiment, GitHub introduced a URL shortening service called git.io, but unfortunately haven’t used it that much ever since. However, one might find it interesting, since it lets you get some sick shortened links for your GitHub repositories or Gists. You could put one on the talk slide (git.io/mapping in the corner deffo looks cooler than github.com/space-donkey/mapping-for-lulz) or whatever. Anyway, imo this feature remains largely overlooked, so I came up with this short note.

In fact, all you have to do is execute this single command and that’s it:

$ curl http://git.io/ --include -F url="https://github.com/space-donkey/mapping-for-lulz" -F code="mapping"

HTTP/1.1 201 Created
Location: http://git.io/mapping

Git.io might return a 201 Created with the wrong vanity code (not the one you specified). It means that someone has already created a shortened link for the page given. Git.io won’t allow multiple links for the page, so the only viable option is to contact GitHub support. I’m fairly sure they are capable of changing it for you!

I made one for my CLI package in Go: http://git.io/climax. It still remains a pretty much useless piece of software, yet now it has a sick shortened link I can post around, yay!