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.

Make your mark

Join the writer's program

Are you a developer and love writing and sharing your knowledge with the world? Join our guest writing program and get paid for writing amazing technical guides. We'll get them to the right readers that will appreciate them.

Write for us
Writer of the month
Marin Bezhanov
Marin is a software engineer and architect with a broad range of experience working...
Build on top of Better Stack

Write a script, app or project on top of Better Stack and share it with the world. Make a public repository and share it with us at our email.

community@betterstack.com

or submit a pull request and help us build better products for everyone.

See the full list of amazing projects on github