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
8
  • Does this still work? Tried this with TortiseSVN and I get a permission error, asking me to supply credentials. Commented Sep 4, 2015 at 14:23
  • 2
    @john I'm sure this is too late to be of much help, but do you have 2-factor authentication enabled on your GitHub account? If so, I think I read somewhere you'll have to use a pre-generated key for the password (which you'll need to find in the GitHub settings). Commented Oct 23, 2015 at 3:07
  • 1
    Regarding the URL formatting, you can keep the .git extension. You can use the full project link, and start by using svn ls followed by the project full path. Example: svn ls https://github.com/RobTillaart/Arduino.git. To export just one folder, you just add the /trunk followed by the desired path, like svn export https://github.com/RobTillaart/Arduino.git/trunk/libraries/DHTlib. It is easier to keep the project path intact. Commented Feb 21, 2016 at 11:33
  • 1
    An example: to download the content in https://github.com/miguelgrinberg/python-socketio/tree/master/examples/wsgi, run svn export https://github.com/miguelgrinberg/python-socketio.git/trunk/examples/wsgi. A directory called wsgi will be created under the current working directory. Only source files, nothing else. No .git, no subversion related files. Commented Mar 10, 2017 at 7:20
  • 1
    Sadly, this will no longer work since Github shut down their Subversion server in early 2024. Commented Feb 21, 2024 at 21:37

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