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.

  1. 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).
  1. Use SVN to Checkout the Directory: Replace REPO_URL with the URL of the GitHub repository, and DIRECTORY_PATH with the path to the directory you want to download.

     
    svn export <https://github.com/USERNAME/REPO_NAME/trunk/DIRECTORY_PATH>
    
Got an article suggestion? Let us know
Explore more
Git
Licensed under CC-BY-NC-SA

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.