Problem: When linking to the raw version of a gist, the link changes with each revision.
Solution:
To return the first file from a gist: https://gist.github.com/[gist_user]/[gist_id]/raw/
- Example: https://gist.github.com/atenni/5604522/raw/
- Works even when you change the filename.
To get a file from multi–file gist: https://gist.github.com/[gist_user]/[gist_id]/raw/[file_name]
An essential tip for those hosting their userscripts on GitHub Gist
Since userscript hosts (e.g. GreaseMonkey, ViolentMonkey, TamperMonkey) require the links to userscripts to end in
user.js
to automatically detect, install and update them, you should usehttps://gist.github.com/[gist_user]/[gist_id]/raw/[file_name]
even for single file gists.Don't forget to set the link as both
@updateURL
and@downloadURL
in the metadata, otherwise the userscript host may assume the versioned download link as an override to updates link if a user installs it by clicking on theRaw
button on the gist page instead.Example
Here's one of my userscripts that I managed to make properly updatable:
https://gist.githubusercontent.com/Erquint/ec4f688c7d6d9ea2ccddff8acb3a8415/raw/FWPMP.user.js
Notice the
@updateURL
and@downloadURL
metadata. The rest is optional