Is there a link to GitHub for downloading a file in the latest release of a repository?
Is there a way to get a link to a specific file of whatever the latest version of a software is?
- How to release web applications?
- How to make a patch for one tag with Git?
- How to build a project with maven using external modules located on git repositories?
- Git-Flow - Creating new features before release is completed
- Change connected commit on release github
- How do I make a releases, builds, and/or snapshots with BitBucket?
e.g., this would be a static link:
What I’d like is something like:
NOTE: The difference between this question and
GitHub latest release is
that this question specifically asks for getting access to the file,
not the GitHub latest release page
11 Solutions collect form web for “Is there a link to GitHub for downloading a file in the latest release of a repository?”
You can do ajax request to get latest release download URL using GitHub Releases API like this:
It also shows when it was released and what the download count is:
jQuery needed for this to work.
Also it is important for you to set latest release URL to download button like this: https://github.com/ShareX/ShareX/releases/latest
When Ajax request complete then URL of this button will change automatically to direct download URL.
I also made downloads page that shows multiple releases which you can find here: https://getsharex.com/downloads/
You can do
View page source to check how it works. But also you can see it from here: https://github.com/ShareX/sharex.github.io/blob/master/downloads/index.html
Linux solution to get latest release asset download link (works only if release has one asset only)
curl -s https://api.github.com/repos/boxbilling/boxbilling/releases/latest | grep browser_download_url | cut -d '"' -f 4
From the command line using
jq, retrieves the first file of the latest release:
curl -s https://api.github.com/repos/porjo/staticserve/releases/latest | \ jq --raw-output '.assets | .browser_download_url'
Another Linux solution using curl and wget to download a single binary file from the latest release page
curl -s -L https://github.com/bosun-monitor/bosun/releases/latest | egrep -o '/bosun-monitor/bosun/releases/download/[0-9]*/scollector-linux-armv6' | wget --base=http://github.com/ -i - -O scollector
curl -s -L is to silently download the latest release HTML (after following redirect)
egrep -o '...' uses regex to find the file you want
wget --base=http://github.com/ -i - converts the relative path from the pipeline to absolute URL
-O scollector sets the desired file name.
may be able to add
-N to only download if the file is newer but S3 was giving a 403 Forbidden error.
Just use one of the urls below to download the latest release:
(took urls from boxbilling project for example): https://api.github.com/repos/boxbilling/boxbilling/releases
Download the latest release as zip:
Download the latest release as tarball:
Click on one of the urls to download the latest release instantly. As i wrote this lines it’s currently: boxbilling-boxbilling-4.20-30-g452ad1c[.zip/.tar.gz]
UPDATE: Found an other url in my logfiles (ref. to example above)
As noted previously, jq is useful for this and other REST APIs.
tl;dr – more details below
Assuming you want the macOS release:
URL=$( curl -s "https://api.github.com/repos/atom/atom/releases/latest" \ | jq -r '.assets | select(.name=="atom-mac.zip") | .browser_download_url' ) curl -LO "$URL"
Solution for atom releases
Note each repo can have different ways of providing the desired artifact, so I will demonstrate for a well-behaved one like atom.
Get the names of the assets published
curl -s "https://api.github.com/repos/atom/atom/releases/latest" \ | jq -r '.assets | .name' atom-1.15.0-delta.nupkg atom-1.15.0-full.nupkg atom-amd64.deb ...
Get the download URL for the desired asset
Below atom-mac is my desired asset via jq’s
curl -s "https://api.github.com/repos/atom/atom/releases/latest" \ | jq -r '.assets | select(.name=="atom-mac.zip") | .browser_download_url' https://github.com/atom/atom/releases/download/v1.15.0/atom-mac.zip
Download the artifact
curl -LO "https://github.com/atom/atom/releases/download/v1.15.0/atom-mac.zip"
jq syntax can be difficult. Here’s a playground for experimenting with the
You should take measures to ensure the validity of the downloaded artifact via sha256sum and gpg, if at all possible.
The Linking to releases help page does mention a “Latest Release” button, but that doesn’t get you a download link.
For that, you need to get the latest tag first (as mentioned in “GitHub URL for latest release of the download file?”):
latestTag=$(git describe --tags `git rev-list --tags --max-count=1`) curl -L https://github.com/reactiveui/ReactiveUI/releases/download/$latestTag/ReactiveUI-$latestTag.zip
in PHP – redirect to the latest release download. Simply put on your webspace
<?php /** * Download latest release from github release articats * License: Public Domain */ define('REPO', 'imi-digital/iRobo'); $opts = [ 'http' => [ 'method' => 'GET', 'header' => [ 'User-Agent: PHP' ] ] ]; $context = stream_context_create($opts); $releases = file_get_contents('https://api.github.com/repos/' . REPO . '/releases', false, $context); $releases = json_decode($releases); $url = $releases->assets->browser_download_url; header('Location: ' . $url);
I want to download the releases from the
I can add links like these to the README file or github pages for all of my repositories:
document.referrer. Thus, teh link will also work for forks.
You can find the source code here, fork or just use my repo.
A solution using (an inner) wget to get the HTML content, filter it for the zip file (with egrep) and then download the zip file (with the outer wget).
wget https://github.com/$(wget https://github.com/<USER>/<PROJECT>/releases/latest -O - | egrep '/.*/.*/.*zip' -o)
In case that the repo is using just tags instead of release — cf. jQuery — the solutions which based on one URL does not work.
Instead, you have to query all tags, sort them and construct the download URL. I implemented such a solution for the language Go and the jQuery repo: Link to Github.
Perhaps, this helps someone.