Tag Archives: Github Gist

Hosting user scripts on Github Gist

Since the main directory for GreaseMonkey user scripts went down years ago, there hasn’t been a more popular go-to place for user scripts. There are mirrors, yes.

But then there’s Github Gist.

Using Github Gist you can quickly brew up your user scripts and at the same time get an easy link to install it.

Note that I won’t go over the specifics of the GreaseMonkey header format here.

  1. A gist will usually only contain a single file with your code. When naming your code file, make sure to end it with .user.js. That way, GreaseMonkey and TamperMonkey will pick up your file as a user script when accessing it via a raw URL.
  2. When pushing updates to the file, you can just update the @version in your header.
  3. So that your GreaseMonkey or TamperMonkey client picks up your code file every time you edit it, you’ll need the raw URL of your code file, sans the Git commit hash. As of the time of writing, the format should be: https://gist.github.com/<your username>/<gist ID>/raw/<filename>.user.js. You should assign this URL as your @downloadUrl and/or @updateUrl.

Theoretically, you should be able to do this with Github, Bitbucket or any other similar Git hosting site as long as the file is publicly accessible. Just make sure the raw link points to the VCS branch you’re updating (master) and not linked to a specific commit.

I’m just mentioning TamperMonkey since that’s what I use. I use Chrome.