The fastest way to download one folder from GitHub

You cannot download a single folder directly from GitHub's website. GitHub's download button always pulls the entire repository. To get just one folder, you need either Git (the command-line tool) with sparse checkout, or a third-party tool like DownGit or GitZip that repackages GitHub's files for you.

The method you choose depends on what you have installed and how comfortable you are with the command line. If you already use Git for other projects, sparse checkout takes about 30 seconds. If you do not have Git installed and want to avoid installing it, a web-based tool is faster.

Key Takeaways

  • GitHub's download button downloads the entire repository, not individual folders, so you need a workaround.
  • Git's sparse checkout feature downloads only the folder you want, but requires Git to be installed on your computer.
  • Web tools like DownGit and GitZip let you download a single folder through your browser without installing anything.
  • The sparse checkout method is fastest if you already use Git; web tools are fastest if you do not.

Using Git sparse checkout from the command line

This method works on Windows, Mac, or Linux if you have Git installed. Open your terminal or command prompt and run these commands in order, replacing the repository URL and folder path with your own.

First, create an empty repository and configure it to pull only the folder you want:

git clone --no-checkout https://github.com/username/repository.git cd repository git sparse-checkout init --cone git sparse-checkout set path/to/folder git checkout

The folder downloads to a new directory named after the repository. If the folder is nested inside other folders (for example, src/components/buttons), use the full path in the git sparse-checkout set command. Git will create that folder structure locally so you can find the files exactly where they are in the repository.

Using DownGit for a browser-based download

DownGit is a free web tool that lets you paste a GitHub link and download a single folder without installing Git. Go to downgit.github.io, paste the link to the folder you want, and click Download.

To get the correct link, open the folder in GitHub, copy the URL from your browser's address bar, and paste it into DownGit. The tool generates a ZIP file containing only that folder and its contents. This method works in any browser and takes about 10 seconds.

DownGit works with public repositories only. If the repository is private, you will need to use Git with sparse checkout instead.

Using GitZip as an alternative

GitZip is a browser extension (available for Chrome and Firefox) that adds a download button directly to GitHub pages. Once installed, you can right-click any folder on GitHub and select "Download selected folder" from the menu.

The extension works the same way as DownGit but saves you the step of visiting a separate website. It also supports private repositories if you are logged into GitHub in your browser. If you download folders from GitHub regularly, the extension is faster than copying and pasting links each time.

Downloading from GitHub Desktop

If you use GitHub Desktop (the graphical interface instead of the command line), you can clone the entire repository and then manually copy the folder you need to another location on your computer. This is slower than the other methods but requires no command-line knowledge.

Open GitHub Desktop, click File, then Clone Repository. Select the repository and choose where to save it. Once the download finishes, open the folder in your file explorer and copy the subfolder you need. This approach works well if you plan to work with the repository later, but it wastes space if you only need one folder.

When each method makes sense

Use Git sparse checkout if you already use Git for version control or plan to pull updates from the folder later. It is the most efficient and gives you the full power of Git commands.

Use DownGit if you need a quick one-time download and do not have Git installed. It works in any browser and requires no setup.

Use GitZip if you download folders from GitHub regularly and want to skip the step of copying links. The browser extension is faster once installed.

Use GitHub Desktop only if you are new to the command line and plan to work with the repository afterward. Otherwise it downloads unnecessary files.

Frequently Asked Questions

Can I download a folder from a private repository?

Yes, but only with Git sparse checkout or GitZip (if you are logged into GitHub). Web tools like DownGit cannot access private repositories. With Git, you need read access to the repository and must authenticate using a personal access token or SSH key.

What if the folder I want is nested several levels deep?

Use the full path in the sparse checkout command: git sparse-checkout set src/components/buttons. Git will recreate the entire folder structure so you can find the files in the same layout as the repository.

Do I need to install Git to download a folder?

No. DownGit and GitZip both work without Git installed. If you do not have Git and do not plan to use it, a web tool is the fastest option.

Will I get updates if I use sparse checkout?

Yes. After the initial download, you can run git pull in the folder to fetch the latest changes from the repository. This works the same way as pulling updates from a full clone.

Why does GitHub not have a built-in download button for folders?

GitHub assumes most users either clone the entire repository or browse files in the web interface. Downloading single folders is less common, so the feature was never added to the main site. Third-party tools fill this gap.