GitHub CLI extension for download folders/files
gh extension install yuler/gh-download
- Download folders/files from GitHub
- Support private repository
- Get GitHub token by
gh config get -h github.com oauth_token
command, for support private repository - Use GitHub
get a tree
API filter path - Path suffix with
/
means is folder, otherwise checked automatically via api - Traverse the folder and download it via curl with GitHub token
# Create alias dl => download
gh alias set dl "download"
# Download files
gh dl yuler/gh-download README.md gh-download
# Download `.github` folders from `cli/cli` repo
gh dl cli/cli .github
# Download from github.com url
gh dl https://github.com/yuler/actions/blob/3541e20e6f195a812b0e775058224a6d6f4b9fc1/ci/nodejs.yml