Download Single File From Private BitBucket Repo
Git Archive
After a little more research I stumbled across git archive
. From the man page: 'Create an archive of files from a
named tree'.. Perfect!
This allows me to do exactly what if I do something like this:
git archive --remote=git@bitbucket.org:<USERNAME>/<REPONAME>.git HEAD <FILENAME> | tar -xf - --to-stdout <FILENAME>
You notice the Git output is piped through tar
this is because the Git archive outputs a tar archive.
I assume this works with GitHub but I haven't tested it.