Skip to content

Instantly share code, notes, and snippets.

@bsnux
Last active November 5, 2021 20:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bsnux/a3ea2d93f5e29dc07a7cf8a2317bd95c to your computer and use it in GitHub Desktop.
Save bsnux/a3ea2d93f5e29dc07a7cf8a2317bd95c to your computer and use it in GitHub Desktop.
Download a release file from a private GitHub repo
#!/bin/bash
# How to download a release file from a private GitHub repo
set -eou pipefail
TOKEN="<your_github_token>"
API_URL="https://api.github.com/repos/<your_repo_here>"
asset_id=$(curl -s -H "Authorization: token $TOKEN" -H "Accept: application/vnd.github.v3.raw" $API_URL/releases \
| jq '.[0].assets[0].id')
curl -s -L -H "Accept: application/octet-stream" -H "Authorization: token $TOKEN" $API_URL/releases/assets/$asset_id \
--output <filename>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment