Skip to content

Instantly share code, notes, and snippets.

@atenni atenni/README.md
Last active Jun 16, 2019

Embed
What would you like to do?
How to permalink to a gist's raw file
@raine

This comment has been minimized.

Copy link

commented Oct 20, 2015

You can't curl https://gist.github.com/[gist_user]/[gist_id]/raw/[file_name] without adding -L flag because it directs to gist.githubusercontent.com

@Asbra

This comment has been minimized.

Copy link

commented Oct 25, 2015

It seems to link to the first revision, not the latest one, right?
Could've used for UpdateURL in UserScript otherwise

@revolter

This comment has been minimized.

Copy link

commented Jan 26, 2016

@Asbra, No, it links to the latest revision. But GreaseMonkey or TamperMonkey doesn't detect it as an userscript, so the install screen doesn't appear.

@wattcommunity

This comment has been minimized.

Copy link

commented Feb 29, 2016

No, this is definitely (initially) linked to the first revision, not reflecting any later changes to the file.

However, it seems this is because it is not be immediate - the change took at least 10 minutes!

@erm3nda

This comment has been minimized.

Copy link

commented May 4, 2016

@raine You don't need to use -L if you know the final url, using a url like https://gist.githubusercontent.com/atenni/5604615/raw works perfectly. But, btw the -L flag works too.

Regarding to the url, I found that it's a nice way to use shorteners that can edit links to permanently link your script. This way users can update their scripts automatically. U can use a known shortener service or just create your own.

@Gerst20051

This comment has been minimized.

Copy link

commented Jun 25, 2016

👍

@houtianze

This comment has been minimized.

Copy link

commented Mar 8, 2017

Cool 👍

@0xcrypto

This comment has been minimized.

Copy link

commented Apr 30, 2017

Or simply use https://rawgit.com

@beppe9000

This comment has been minimized.

Copy link

commented May 15, 2017

@multlurk

This comment has been minimized.

Copy link

commented Jul 8, 2017

👍

@inspector71

This comment has been minimized.

Copy link

commented Aug 15, 2017

How did you get such short a gist_id in your examples? I realise git hashes can often be shortened but it's not happening for me:

https://gist.githubusercontent.com/inspector71/59e5598/raw/

returns a 404 whereas:

https://gist.githubusercontent.com/inspector71/59e559824edfead1b0d3366ce402a687/raw

returns expected result.

@aleclarson

This comment has been minimized.

Copy link

commented Jan 2, 2018

Thanks! 👍

@avatar-lavventura

This comment has been minimized.

Copy link

commented Apr 25, 2018

Thanks mate!

@MatheusRV

This comment has been minimized.

Copy link

commented May 5, 2018

Tks

@yairEO

This comment has been minimized.

Copy link

commented Jul 5, 2018

Here's a related StackOverflow question which is of high-value to this thread

@LM1LC3N7

This comment has been minimized.

Copy link

commented Feb 27, 2019

Thanks! 👍 👍

@Deledrius

This comment has been minimized.

Copy link

commented May 15, 2019

@Asbra, No, it links to the latest revision. But GreaseMonkey or TamperMonkey doesn't detect it as an userscript, so the install screen doesn't appear.

@revolter -- As long as the file is correctly named (i.e., ending with .user.js or .user.css) the full format should work, even for single-file gists. I tested this with both Stylus and Greasemonkey, and they pick up the files correctly and automatically ask to install: https://gist.github.com/[gist_user]/[gist_id]/raw/scriptname.user.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.