【发布时间】:2011-11-14 12:11:56
【问题描述】:
我想从 git 存储库中获取 单个文件。使用SVN,我可以使用svn export,如下:
sudo svn export http://www.example.com/repos/Trunk/pathtofile/file.ext
这只是下载文件,赤裸裸的,即没有任何存储库信息。
git 中是否有与svn export 等价的东西?
我得到的最接近的是“git show upstream/master:pathtofile/file.ext”,但这并不完全等同,因为您已经需要在 git repo 中才能使其工作。
我有另一个选择,因为我使用的是 github,所以尝试wget github 原始文件。
wget https://raw.github.com/<mygithubuser>/repo/master/pathtofile/file.ext?login=<mylogin>&token=<notsurewhattoputhere>
问题是 repo 是私有的,所以我需要提供一个令牌,但我不确定如何生成它并在 wget 中使用它?
【问题讨论】:
-
我同意,它类似于 stackoverflow.com/questions/8121379... 但它不是那个问题的副本,我在那里找不到解决方案。