5

I am looking at a GitHub release that contains over 200 .tgz files that I want to download. Is there any way to download them all in bulk within one line/script, as opposed to downloading them each individually?

Because it is not exactly hosted on the GitHub repository, I can't clone the master repository either. How should I go about this efficiently?

2 Answers 2

8

The github cli (gh) can be used for this. Here are the docs.

This is for downloading all files (github release assets) from a specific github release.

gh release list -R <username>/<repo>
gh release download <tag> -D <dest> -R <username>/<repo>

# for eg.
gh release list -R cli/cli
gh release download v2.21.2 -D gh_v2.21.2 -R cli/cli

# download all assets from latest release to gh_latest directory
gh release download -p "*" -D gh_latest -R cli/cli

Note:

  • If you are in a git repository, gh release download <tag> will download all the assets from the latest release to the current directory. No need to specify -R -D.

  • If the tag is not specified, it will download the latest release but complain that one of the -A or -p flags is required. In such case gh release download -p "*" can be used.

  • Check the examples in the docs for more.

1
  • Here's a way to download the latest release gh release download -R raaka/cpp `gh release list -R raaka/cpp -L 1| awk '{print $5}'` until github.com/cli/cli/issues/2310 is fixed.
    – Raaka
    Commented Aug 3, 2023 at 17:41
1

You can use the GitHub API to get a list of releases and to download each release by tag name.

Reference:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.