I want to fetch a single file from a git repository. Using SVN, I can use svn export
as follows:
sudo svn export http://www.example.com/repos/Trunk/pathtofile/file.ext
This just downloads the file, naked, i.e without any repository info with it.
Is there an equivalent to svn export
in git?
The closest I got was "git show upstream/master:pathtofile/file.ext
" but this isn't really equivalent because you already need to be inside a git repo for it to work.
Another option I have, because I'm using github, is to try to wget
the github raw file.
wget https://raw.github.com/<mygithubuser>/repo/master/pathtofile/file.ext?login=<mylogin>&token=<notsurewhattoputhere>
The problem is that the repo is private so I need to supply a token and I'm not sure how to generate this and use it in a wget
?