简体   繁体   中英

How to download with wget a release jar from my private github repo?

my question is about wget and github. I have a private repo in github and built a release, tag release-3, appHappy.jar. Now the challenge is to download the the appHappy.jar from the private repo tag release-3 with wget. I also made an private token(with all grants) and then I wrote this statement

$wget --header='Authorization: token HappyFakeToken' https://api.github.com/repos/speedyG/privateRepo/releases/releases-3/appHappy.jar

but I get a 404: Not Found...

what's wrong?

I read already, but I have no idea how solve the problem... https://developer.github.com/v3/repos/releases/#get-a-single-release

Can anybody give me a hint?

The URLs for assets aren't listed directly under the repository, and the release ID is an integer, not a string. The easiest way to do this is to query the releases endpoint for your repository and then search the JSON for the appropriate browser_download_url endpoint.

For example, if I wanted to download the file git-lfs-v2.9.0.tar.gz from the latest Git LFS release (v2.9.0), I'd do this to find the URL:

wget -O- https://api.github.com/repos/git-lfs/git-lfs/releases | \
  jq -r '.[] | select (.name == "v2.9.0") | .assets | .[] | 
         select(.name == "git-lfs-v2.9.0.tar.gz") | .browser_download_url'

I'd then use that URL in a future curl or wget command to download it. Note that this endpoint is paginated; if there are a large number of releases, you may need to walk through the pages. At that point, it may be better to pick a language other than shell.

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