Search code examples
gist

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


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

Solution

  • 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}