最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

git - How to download a specific GitHub folder without its subdirectories? - Stack Overflow

programmeradmin1浏览0评论

I know these two amazing websites to do that easily: Download Directory and DownGit.

The problem is that they both work recursively, so if I for example give this link: it will also download the subdirectories, which is not ideal in my case, since there are A LOT of files.

Is there a tool or website to just download a directory without its subdirectories?

I know these two amazing websites to do that easily: Download Directory and DownGit.

The problem is that they both work recursively, so if I for example give this link: https://github/danielmiessler/SecLists/tree/master/Passwords it will also download the subdirectories, which is not ideal in my case, since there are A LOT of files.

Is there a tool or website to just download a directory without its subdirectories?

Share Improve this question edited Mar 30 at 8:29 dani-vta 7,5007 gold badges49 silver badges65 bronze badges asked Mar 30 at 8:05 allexjallexj 1274 bronze badges 3
  • 1 So you want to download the files in /Passwords, but not in /Passwords/Books etc? – Martheen Commented Mar 30 at 8:13
  • exactly that's what I want – allexj Commented Mar 30 at 8:17
  • @allexj did my post answer your question or are you still having issues with it? – dani-vta Commented yesterday
Add a comment  | 

1 Answer 1

Reset to default 2

To download just a subset of a repository, you could perform a sparse clone and then use the sparse-checkout command.

The sparse clone will download only the top level directory of your repository, while sparse-checkout will incrementally grow the working directory with just the content you're interested in.

# clone just the top level directory of your repo
git clone --sparse <URL> -- myrepo

# cd into the repo
cd myrepo/

# provide the subcommand set with a list of patterns to checkout,
# in your case just 'Passwords' without its subfolders
git sparse-checkout set --no-cone Passwords '!Passwords/*/**'
发布评论

评论列表(0)

  1. 暂无评论