Skip to content

Instantly share code, notes, and snippets.

@iperdomo
Last active January 9, 2021 22:34
Show Gist options
  • Save iperdomo/a593f90c21308808b91f0167599b81d0 to your computer and use it in GitHub Desktop.
Save iperdomo/a593f90c21308808b91f0167599b81d0 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Note: It only supports GitHub, no caching nor fancy error handling
set -euo pipefail
repo="${1}"
directory="${repo/*\//}"
mkdir -p "${directory}"
curl --location "https://api.github.com/repos/${repo}/tarball" | \
tar --extract --ungzip --strip-components=1 --directory "${directory}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment