Skip to main content
Stack Overflow
  1. About
  2. For Teams

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

Download a single folder or directory from a GitHub repository

How can I download only a specific folder or directory from a remote Git repository hosted on GitHub?

Say the example GitHub repository lives here:

[email protected]:foobar/Test.git

Its directory structure:

Test/
├── foo/
│ ├── a.py
│ └── b.py
└── bar/
 ├── c.py
 └── d.py

I want to download only the foo folder and not clone the whole Test project.

Answer*

Draft saved
Draft discarded
Cancel
21
  • 30
    The base method is- 1. take the directory link (used angular-route), 2. go to GitHub API, 3. search through the directory and download all files, 4. create a zip file with it (I have used jszip) & save it as file (used filesaver for this). For clear understanding I would suggest to take a look in my project. Commented Aug 20, 2016 at 10:06
  • 15
    This is cool but it doesn't work with automated tools (like wget) Commented Jan 25, 2018 at 21:10
  • 5
    DownGit was exactly what I needed: To download a specific folder from a repo without creating a new git directory in order to do so (like the subversion method requires). Thanks very much for making this. Commented May 10, 2022 at 5:09
  • 25
    The website got blacklisted by my antivirus... Commented Aug 19, 2023 at 20:34
  • 3
    @VascoCansadoCarvalho Blacklisted by my antivirus too. I ended up using downgit.github.io which worked fine. Commented Nov 17, 2024 at 23:15

AltStyle によって変換されたページ (->オリジナル) /