Download Latest Release Asset From GitHub Repository

Download Latest Release Asset From GitHub Repository

GitHub release feature allows sharing download links for specific versions of the published assets. But, if you want to get the latest version, you'll need to update the version number in the URL whenever a new release comes out. GitHub provides a way how to make a direct link to download the latest release asset. This tutorial demonstrates how to download latest release asset from GitHub repository.

To provide a link to a repository's latest release, simply add releases/latest to the end of the repository's URL. For instance, the URL for the most recent release of prepkg/opencv-raspberrypi on GitHub is:

To create a direct link to download the latest release asset that has been manually uploaded, use the suffix /releases/latest/download/asset-name. For example:

We can utilize the curl command to download the most recent version of a release asset from GitHub. For example:

curl -Lo opencv.deb

These are options provided to the curl command:

  • -L - instructs curl to follow any redirects. In this case, if the URL provided redirects to another location, curl will automatically follow the redirect to the final location of the file.
  • -o opencv.deb - specifies the name of the output file. In this case, the downloaded file will be saved as opencv.deb in the current working directory.

To hide the progress bar while downloading the file, run the command:

curl -sSLo opencv.deb
  • -s - stands for "silent" and suppresses the progress bar as well as any other unnecessary output. It allows you to run the command without seeing progress information.
  • -S - this option, in combination with the -s option, shows errors. If an error occurs during the download, this option will ensure that the error message is displayed, even though the progress bar is hidden.

Leave a Comment

Cancel reply

Your email address will not be published.