3

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?

Yurroffian
  • 61
  • 2
  • 6

2 Answers2

2

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.

Phani Rithvij
  • 4,030
  • 3
  • 25
  • 60
  • 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 https://github.com/cli/cli/issues/2310 is fixed. – Raaka Aug 03 '23 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:

mkrieger1
  • 19,194
  • 5
  • 54
  • 65