背景
我们有时候需要下载GitHub中某个仓库的部分目录而不是整个,怎么办?
方法1
- 使用 https://minhaskamal.github.io/DownGit/#/home
在GitHub中切换好你要下载的分支,进入到你要下载的GitHub的目录,拷贝网页链接到DownGit的输入框中
直接在该网站点击 Download 即可下载(也可以复制下载链接后在浏览器打开或下载工具中打开)
注意:下载看来是经过了第三方的网站,有可能会在这个网站留下下载日志甚至下载包。不过由于是外国的网站比起国内的网站可信一点。
- 使用 http://blog.luckly-mjw.cn/tool-show/github-directory-downloader/index.html
方法同上。不过这个是国人的(请自行斟酌风险)
方法2(麻烦一些,但是是最保险的)
假设要下载的仓库是
- master分支:
https://github.com/xxxxx/test-download-partial-dir/tree/master/resource1
替换/tree/master/为/trunk/得到 https://github.com/xxxxx/test-download-partial-dir/trunk/resource1
在命令行中使用svn checkout 这个地址 - develop分支:
https://github.com/xxxxx/test-download-partial-dir/tree/develop/resource1
替换/tree/develop/为/branches/your_branchname/比如替换成 https://github.com/xxxxx/test-download-partial-dir/branches/develop/resource1
然后用svn checkout 这个地址
这篇博客介绍了两种方法从GitHub下载特定仓库的目录而非整个仓库。第一种方法是使用DownGit或国内的GitHub Directory Downloader网站,只需复制GitHub目录链接并下载。第二种方法涉及使用svn checkout命令,通过替换URL中的分支路径来下载。虽然第一种方法更简便,但可能涉及第三方网站的风险,而第二种方法则更为保险。
1034

被折叠的 条评论
为什么被折叠?



