如何从 github 下载目录
How do I download a directory from github
现在我知道在 overflow 上有几个这样的问题,但是其中有几个答案对我来说很失败。如果相关的话,我正在使用 Cygwin。我运行
svn export https://github.com/Wikia/app/tree/dev/extensions/wikia/AdminDashboard
接收结果:
svn: E170000: URL 'http://github.com/Wikia/app/tree/dev/extensions/wikia/AdminDashboard' doesn't exist
我也运行
curl -L http://github.com/Wikia/app/tree/dev/extensions/wikia/AdminDashboard > project.tar.gz
接收 .tar.gz 文件,7-Zip 无法读取文件并给出错误:
两点备注:
- A GitHub 存储库不能与 svn 命令一起使用
- url不存在。
GitHub 回购是最好的整体克隆,但你可以做一个 sparse checkout as in this gist or this article:
新存储库
mkdir <repo> && cd <repo>
git init
git remote add –f <name> <url>
git config core.sparsecheckout true
echo some/dir/ >> .git/info/sparse-checkout
echo another/sub/tree >> .git/info/sparse-checkout
git pull <remote> <branch>
现有存储库
git config core.sparsecheckout true
echo some/dir/ >> .git/info/sparse-checkout
echo another/sub/tree >> .git/info/sparse-checkout
git read-tree -mu HEAD
If you later decide to change which directories you would like checked out,
simply edit the sparse-checkout
file and run git read-tree
again as above.
现在我知道在 overflow 上有几个这样的问题,但是其中有几个答案对我来说很失败。如果相关的话,我正在使用 Cygwin。我运行
svn export https://github.com/Wikia/app/tree/dev/extensions/wikia/AdminDashboard
接收结果:
svn: E170000: URL 'http://github.com/Wikia/app/tree/dev/extensions/wikia/AdminDashboard' doesn't exist
我也运行
curl -L http://github.com/Wikia/app/tree/dev/extensions/wikia/AdminDashboard > project.tar.gz
接收 .tar.gz 文件,7-Zip 无法读取文件并给出错误:
两点备注:
- A GitHub 存储库不能与 svn 命令一起使用
- url不存在。
GitHub 回购是最好的整体克隆,但你可以做一个 sparse checkout as in this gist or this article:
新存储库
mkdir <repo> && cd <repo>
git init
git remote add –f <name> <url>
git config core.sparsecheckout true
echo some/dir/ >> .git/info/sparse-checkout
echo another/sub/tree >> .git/info/sparse-checkout
git pull <remote> <branch>
现有存储库
git config core.sparsecheckout true
echo some/dir/ >> .git/info/sparse-checkout
echo another/sub/tree >> .git/info/sparse-checkout
git read-tree -mu HEAD
If you later decide to change which directories you would like checked out, simply edit the
sparse-checkout
file and rungit read-tree
again as above.