简体   繁体   中英

How to download all files from GitHub release?

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?

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

Reference:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM