Download a Single Folder or Directory from a Github Repository
Better Stack Team
Updated on July 25, 2024
Downloading a single folder or directory from a GitHub repository directly is not straightforward through the GitHub web interface, as GitHub does not provide an option to download individual directories. However, there is a method to download a single directory or file from GitHub.
Using svn
(Subversion)
GitHub supports Subversion (SVN), and you can use SVN to check out a single directory.
Install Subversion:
On macOS:
brew install svn
- On Ubuntu/Debian:
```
sudo apt-get install subversion
```
- On Windows, you can install SVN from [the Subversion official site](https://subversion.apache.org/packages.html).
Use SVN to Checkout the Directory: Replace
REPO_URL
with the URL of the GitHub repository, andDIRECTORY_PATH
with the path to the directory you want to download.svn export <https://github.com/USERNAME/REPO_NAME/trunk/DIRECTORY_PATH>