How do I get the raw version of a gist from github?

dee picture dee · May 16, 2013 · Viewed 10.9k times · Source

I need to load a shell script from a raw gist but I can't find a way to get raw URL.

curl -L address-to-raw-gist.sh | bash

Answer

aymericbeaumet picture aymericbeaumet · May 16, 2013

And yet there is, look for the raw button (on the top-right of the source code).

The raw URL should look like this:

https://gist.githubusercontent.com/{user}/{gist_hash}/raw/{commit_hash}/{file}

Note: it is possible to get the latest version by omitting the {commit_hash} part, as shown below:

https://gist.githubusercontent.com/{user}/{gist_hash}/raw/{file}