Created
January 25, 2014 00:34
-
-
Save kevinchampion/8609773 to your computer and use it in GitHub Desktop.
Downloads a file from a private repo on GitHub
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
USER="$1" | |
PROJECT="$2" | |
FILE="$3" | |
DESTINATION="$4" | |
TOKEN="$5" | |
REF="$6" | |
FILEDATA=$(curl https://api.github.com/repos/${USER}/${PROJECT}/contents/${FILE}?access_token=${TOKEN}&REF=${ref}) | |
URL=$(echo $FILEDATA | jq --raw-output '.git_url') | |
# echo curl -H '"Accept: application/vnd.github.v3.raw"' $URL?access_token=${TOKEN} -o ${DESTINATION}${FILE} | |
curl -H "Accept: application/vnd.github.v3.raw" $URL?access_token=${TOKEN} -o ${DESTINATION}${FILE} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment