Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do raw.githubusercontent.com URLs represent?

I want to learn how to use rawgit.com to serve other applications from github.com. So we have a usual way to download and install homebrew on osx.

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 

I can't find the install file on GitHub. Where is it?

like image 454
megas Avatar asked Aug 21 '16 15:08

megas


People also ask

What are raw urls?

The raw URL is defined as the part of the URL following the domain information. In the URL string http://www.contoso.com/articles/recent.aspx, the raw URL is /articles/recent. aspx. The raw URL includes the query string, if present.

Is raw Githubusercontent com safe?

The domain name raw.githubusercontent.com is incredibly valuable to a malicious actor looking to be able to serve their own malicious content to any site that is using raw.githubusercontent.com as a CDN (even though you explicitly advise against people from doing this).

What is GitHub raw URL?

GitHub raw url ActionThe Action converts a normal GitHub file url to its raw url format. For example, the raw url of https://github.com/actioncloud/github-raw-url/blob/master/index.js is: https://raw.githubusercontent.com/actioncloud/github-raw-url/master/index.js.

What does RAW mean in GitHub?

The Raw button, like the name suggests, opens the file in a raw form, meaning that any HTML formatting disappears. This is particularly useful when you want to download a single file.

Where can I find the raw url of a GitHub repository?

The raw.githubusercontent.com domain is used to serve unprocessed versions of files stored in GitHub repositories. If you browse to a file on GitHub and then click the Raw link, that's where you'll go. The URL in your question references the install file in the master branch of the Homebrew/install repository.

What is the raw domain used for?

The raw.githubusercontent.com domain is used to serve unprocessed versions of files stored in GitHub repositories. If you browse to a file on GitHub and then click the Raw link, that's where you'll go.

Where can I find the install file of a GitHub repository?

Show activity on this post. The raw.githubusercontent.com domain is used to serve unprocessed versions of files stored in GitHub repositories. If you browse to a file on GitHub and then click the Raw link, that's where you'll go. The URL in your question references the install file in the master branch of the Homebrew/install repository.

How do I download raw files from GitHub?

raw.githubusercontent.com returns the raw content of files stored in github, so they can be downloaded simply to your computer. For example, if the page represents a ruby install script, then you will get a ruby install script that your ruby installation will understand.


2 Answers

The raw.githubusercontent.com domain is used to serve unprocessed versions of files stored in GitHub repositories. If you browse to a file on GitHub and then click the Raw link, that's where you'll go.

The URL in your question references the install file in the master branch of the Homebrew/install repository. The rest of that command just retrieves the file and runs ruby on its contents.

like image 122
Chris Avatar answered Sep 16 '22 15:09

Chris


There are two ways of looking at github content, the "raw" way and the "Web page" way.

raw.githubusercontent.com returns the raw content of files stored in github, so they can be downloaded simply to your computer. For example, if the page represents a ruby install script, then you will get a ruby install script that your ruby installation will understand.

If you instead download the file using the github.com link, you will actually be downloading a web page with buttons and comments and which displays your wanted script in the middle -- it's what you want to give to your web browser to get a nice page to look at, but for the computer, it is not a script that can be executed or code that can be compiled, but a web page to be displayed. That web page has a button called Raw that sends you to the corresponding content on raw.githubusercontent.com.

To see the content of raw.githubusercontent.com/${user}/${repo}/${branch}/${path} in the usual github interface:

  1. you replace raw.githubusercontent.com with plain github.com
  2. AND you insert "blob" between the repo name and the branch name.

In this case, the user is "Homebrew", the repo is "install", the branch name is "master" (which is a very common branch name). You insert "blob" between "install" and "master", so

https://raw.githubusercontent.com/Homebrew/install/master/install 

becomes

https://github.com/Homebrew/install/blob/master/install 

This is the reverse of finding a file on Github and clicking the Raw link.

like image 25
Law29 Avatar answered Sep 19 '22 15:09

Law29