If you only need one folder from a large GitHub repository, cloning the entire thing is wasteful. A repo that's hundreds of megabytes becomes a problem when you just want the /examples folder or a single /src/components directory.
This guide covers every method — from the command line to a one-click tool — so you can pick what works for your situation.
Why GitHub Doesn't Let You Download Folders Directly
GitHub's interface only gives you two built-in options: clone the full repository, or download the entire repo as a ZIP. There's no native "download this folder" button. For large repos, both options pull down far more than you need.
Fortunately there are three ways around this.
Method 1: Use a GitHub Folder Downloader (Easiest)
The fastest option — no Git, no terminal, no setup.
- Navigate to the folder you want on GitHub
- Copy the URL from your browser (e.g.
https://github.com/user/repo/tree/main/folder-name) - Paste it into GitHub Folder Downloader
- Click Download ZIP
The tool uses the GitHub API to fetch only the files inside that folder and zips them on the fly. Works on any public repository, any branch, any folder depth.
Best for: anyone who doesn't want to touch the command line, or needs a folder quickly from an unfamiliar repo.
Method 2: Git Sparse Checkout (Command Line)
If you prefer the terminal or need to keep the folder in sync with the repo, Git's sparse checkout feature lets you pull only a specific directory.
# Create a new directory and initialise Git
mkdir my-folder && cd my-folder
git init
git remote add origin https://github.com/user/repo.git
# Enable sparse checkout
git sparse-checkout init --cone
git sparse-checkout set folder-name
# Pull only that folder
git pull origin main
Replace folder-name with the path to your target folder and main with the correct branch name.
Best for: developers who want version control or need to stay in sync with upstream changes.
Method 3: Download the Full Repo ZIP and Extract
The blunt option — GitHub lets you download any repository as a ZIP via Code → Download ZIP. Once downloaded, navigate to the folder you need and discard the rest.
Best for: small repositories where the total size isn't a problem.
Method Comparison
| Method | Requires Git | Works on large repos | Keeps in sync |
|---|---|---|---|
| GitHub Folder Downloader | No | Yes | No |
| Git sparse checkout | Yes | Yes | Yes |
| Full repo ZIP | No | Painful | No |
Common Issues
"Invalid URL" error — Make sure you're copying the folder URL from GitHub, not a file URL. It should contain /tree/ in the path, not /blob/.
Private repository — The folder downloader only works with public repositories. For private repos, use git sparse checkout with your credentials.
Wrong branch — The URL includes the branch name. If you're getting unexpected files, check that the branch in the URL matches the one you want.
Large folders timing out — Folders with hundreds of files may take a few seconds. If it times out, try again — the GitHub API occasionally rate-limits requests.
Which Method Should You Use?
If you just need a folder quickly and don't want to open a terminal — use GitHub Folder Downloader. Paste the URL, click download, done.
If you're a developer who wants to stay in sync with the repo or work with private repositories — sparse checkout is the right tool.
Everything else is a workaround.
Top comments (0)