On GitHub there is a raw button that allows you to download the raw contents of a file. The raw URL is for that particular version of the file.
Is it possible to get a raw URL that always downloads the latest version of a file?
CodePudding user response:
It's possible to specify a branch name instead of an object ID in the URL. For example, to always get the version of Git's README that's on the master
branch, you can use https://raw.githubusercontent.com/git/git/master/README.md.
However, be aware that, like all accesses to raw.githubusercontent.com
, there is caching involved and that can't be disabled, so while the URL will eventually be updated, it may not be immediately. If you need the absolute latest version of a file at all times, or if you need that file for an automated process (such as another website or a program), then you need to host it yourself.