Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get raw file from GitHub without waiting for 5-minute cache update

Tags:

github

GitHub hosts raw files at https://raw.githubusercontent.com. You can use that link to download the raw contents of the file.

When you push a change to the file, it doesn't update instantly. According to this question, the raw files are updated after 5 minutes.

My question is, is there any way to bypass this cool-down and get the raw version of the latest file instantly?

like image 523
TheKingElessar Avatar asked Jul 08 '20 00:07

TheKingElessar


People also ask

How long does it take to update raw GitHub?

GitHub serves "raw" pages with Cache-Control: max-age=300 . That's specified in seconds, meaning the pages are intended to be cached for 5 minutes. You can see this if you open the Developer Tools in your web browser of choice before clicking the "Raw" button on GitHub.

How can I get raw code from GitHub?

To look at the raw markdown file you need to click on the raw button (top right of the white box). This takes you to the markdown raw file that is rendered into a nicely formatted README.md file on GitHub.

Where is view raw in GitHub?

Viewing or copying the raw file content 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.

What does RAW mean 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.

How long are the raw pages cached in GitHub?

That's specified in seconds, meaning the pages are intended to be cached for 5 minutes. You can see this if you open the Developer Tools in your web browser of choice before clicking the "Raw" button on GitHub. Thanks for contributing an answer to Stack Overflow!

How to get the raw version of a file from GitHub?

Have any method to get raw version of the file was commit. GitHub serves "raw" pages with Cache-Control: max-age=300. That's specified in seconds, meaning the pages are intended to be cached for 5 minutes. You can see this if you open the Developer Tools in your web browser of choice before clicking the "Raw" button on GitHub.

How does githubraw serve raw files?

GitHubRaw serves raw files directly from GitHub with proper Content-Type headers. No traffic limits or throttling. Files are served via CloudFlare 's super fast global CDN. Use a specific tag or commit hash in the URL (not a branch). Files are cached permanently based on the URL. Query strings are ignored.

How do I pull data from a GitHub repository?

The simplest way would be to go to the github page of the content you want and right-click to get the [raw] link for each file. If your needs are more complex, requiring many files, etc. you may want to abandon wget and curl and just use git. It is probably a more appropriate tool for pulling data from git repositories.


1 Answers

No, there isn't a way to bypass it. GitHub uses caching to make it possible to serve large numbers of requests and that means that URLs on that endpoint may be slightly stale. If you need the latest version, you can access the URL by hash instead of by branch or tag name and that will always be correct. From the main web interface (not a raw file URL), you can hit the y key to automatically switch to an appropriate tree or commit instead of the branch name, and then the raw URLs will be correct for your version of the code.

like image 147
bk2204 Avatar answered Oct 23 '22 04:10

bk2204