Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitHub Gist: RAW Permalink won't update

Tags:

git

github

I have a URL to a gist, raw version but it won't always update. Say I get the raw link

https://gist.githubusercontent.com/username/27610b513177a762470ac95160c050fd/raw/f567a5ade06c9b8e7c101fe62fa3a4cac07e5bd7/test%2520gist

But I change the contents of that gist, the URL will change, the first link WONT include the changes.

https://gist.githubusercontent.com/username/27610b513177a762470ac95160c050fd/raw/60e3b421faa7e4e9ea6cd27e4a6ffd4809d3d40e/test%2520gist

How do I make 1 PERMANENT link that will forever include all the changes, not just the revision for that link?

I've tried with the ID, and just the id/raw but the ID isn't even a number like other people say, its more like a hash, can anyone help here?

UPDATE:

I've tried [the suggested answer], but it still leads to the last revision, does it have a delay in updating?

like image 254
zhorachu Avatar asked Nov 02 '17 01:11

zhorachu


People also ask

How do I get a gist URL?

You can embed a gist in any text field that supports Javascript, such as a blog post. To get the embed code, click the clipboard icon next to the Embed URL of a gist. To embed a specific gist file, append the Embed URL with ? file=FILENAME .

How do I view RAW files in GitHub?

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. Optionally, to copy the raw file content, in the upper-right corner of the file view, click .

What is a GitHub Gist link?

What is Gist? Gist is an easy method to share snippets or excerpts of data with others. A gist can be a string of code, a bash script or some other small piece of data. These bits of information are hosted by GitHub as a repository.

How do I download gist files?

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.


2 Answers

the ID isn't even a number like other people say, its more like a hash

Yes, a gist is a git repo

As explained here by Mark Engel:

Imagine you want to host a json configuration file somewhere. You also don’t want to host it yourself, but would prefer to rely on a stable provider.

You can use gist.github.com for this job.

For example this gist. You can see that there are 2 revisions.

If you click on raw you get the current version

  • Version 1 https://gist.githubusercontent.com/mren/17da9837f691acd2e8ae/raw/9e26dfeeb6e641a33dae4961196235bdb965b21b/config.json
  • Version 2 https://gist.githubusercontent.com/mren/17da9837f691acd2e8ae/raw/afd0087d1b230bbc663ae4f4a1e9a1bc426d7eef/config.json

In each version you see two hashes.

  • One hash is equal in both hashes. This is the hash of the gist
  • The other hash is the hash of the commit.

If you remove the last one the raw file always points to the latest revision

https://gist.githubusercontent.com/mren/17da9837f691acd2e8ae/raw/config.json

like image 136
VonC Avatar answered Oct 30 '22 17:10

VonC


Reviving this link to clarify the confusion.

Yes, VonC's answer is right,

If you remove the last one the raw file always points to the latest revision

and,

permanent URL ... will always "include all the changes"

However, it may do INDEED take some time to update.

Today, I was using bit.ly to shorten my permanent URL, but found it always points to the last/initial version that I set the short URL. So I have to give it up and try different URL shortening services. Only after trying two or three more did I realize that the problem is not at URL shortening service side but the gist permanent URL side -- confirmed by visiting the gist permanent URL directly, and --

it does take more than two or three minutes to update some times today, when I keep changing it to see what's wrong. But it does eventually change to the latest version as well. Confirmed by revisiting my bit.ly shortened URL as well.

like image 4
xpt Avatar answered Oct 30 '22 18:10

xpt