Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

gist

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 
like image 827
dee Avatar asked May 16 '13 13:05

dee


People also ask

Where is raw in GitHub?

With the raw view, you can view or copy the raw content of a file without any styling. On GitHub.com, navigate to the main page of the repository. Click the file that you want to view. In the upper-right corner of the file view, click Raw.

How do I download gists from GitHub?

The only way you can do it using GithubGist is to open each and every individual gist to download ZIP or clone via HTTP or SSH. This article is all about making the above task simpler. Using the commands below, you can even download gists from other github users excluding the private ones until you know their password.

How do I find my GitHub gist?

Once you have logged into your GitHub account, click on your username in the top right corner. This will open a menu where you can see an option called 'Your gists'. Once you clicked that option, you will see your gist page.


2 Answers

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} 
like image 133
aymericbeaumet Avatar answered Sep 21 '22 09:09

aymericbeaumet


February 2014: the raw url just changed.
See "Gist raw file URI change":

The raw host for all Gist files is changing immediately.
This change was made to further isolate user content from trusted GitHub applications.

The new host is

 https://gist.githubusercontent.com.  

Existing URIs will redirect to the new host.

Before it was https://gist.github.com/<username>/<gist-id>/raw/...

Now it is https://gist.githubusercontent.com/<username>/<gist-id>/raw/...

For instance:

https://gist.githubusercontent.com/VonC/9184693/raw/30d74d258442c7c65512eafab474568dd706c430/testNewGist

KrisWebDev adds in the comments:

If you want the last version of a Gist document, just remove the <commit>/ from URL

https://gist.githubusercontent.com/VonC/9184693/raw/testNewGist

like image 44
VonC Avatar answered Sep 20 '22 09:09

VonC