Skip to main content

GitHub Fundamentals

How to Download Files and Folders From GitHub?

Want to download an entire GitHub repository or just a selected few files and folders? Here's how you can do it all.

Cloning a GitHub repository to your local system is perhaps the most straightforward way to get the source code files.

But you may not always want to clone a repo just to download a few files from GitHub.

There are multiple ways to download files from GitHub depending upon what you want to download:

  • Download the entire source code repository in zip format from GitHub website
  • Download a single file from GitHub repo
  • Download a folder from GitHub (using a web tool)
  • Download selected files and folders (using a browser extension)

Let me show all the above use cases in detail.

Download entire GitHub repo (without cloning it)

It's simple, just open the Repository, and you will see a <> Code button. When you click on it, you'll see different options.

Click on the Download ZIP button and the entire repository will be downloaded as a ZIP file.

Location of the Download Zip button in a GitHub Repository

That's neat. How about getting a single file from GitHub? Not too complicated either.

Download a single file from GitHub

Go to the File in the repository.

You can click the file (if you see it). You may also use the Go to File button on the front page of the repo to quickly search the file.

Once you have opened the individual file, click on the Download Raw File button on the top right (see the image below)

Location of the Download Raw File button in a GitHub Repo File Page

And the file will be downloaded on your system.

Nice, isn't it? Let's see about downloading a single folder from GitHub.

Download a specific folder from a GitHub repository

🀚
GitHub doesn't provide a way to download a specific folder from a repository. It can still be done through an open source web-tool called Download Directory.

Go to the folder in the repository that you want to download.

Downloading a folder from GitHub repo
I am downloading Nextcloud folder

Copy the URL path of that GitHub repo folder. It should look something like this: https://github.com/username/Repo-Name/tree/main/folderName

Copying the URL of a folder to download it from GitHub
Copy the URL of the folder you want to download

Go to download-directory.github.io and paste the URL and press Enter:

Downloading GitHub folder
Paste the URL of the folder and press the enter key

That's it! Your Folder will be downloaded in zip format. You can see the status of generating the zip file and the final download status.

Folder downloaded from GitHub

Ah, it feels so good to see that our Open-Source community has all kinds of hacks and workarounds, doesn't it? ☺️

🚧
Quite obviously, this method will only work with public repositories. Folders from private GitHub repositories cannot be downloaded this way.

Download multiple files and folders from GitHub

Sometimes you may not need a whole repo, a folder or a single file, but multiple files probably from multiple locations in the repo.

GitHub doesn't support such a feature officially. However, you can install this browser extension named GitZip. It's Open Source - GitHub Repo.

🀚
Though the mentioned browser extension (GitZip) is open source, use it at your discretion. We are not affiliated with it and recommend researching it thoroughly before use.

You can use that tool to select & download multiple files & folders, but they need to be on the same Location/URL. So let's say you want to download the files & folders marked in the image down below -

Markings to show which files and folders we want to download in a GitHub Repo

Simply hover over those files/folders and a checkbox will appear, select your desired ones and you will see a Download button appear at the left bottom, click on that and the selected files/folders will be downloaded.

Locating the download button to download the selected files/folders using the GitZip Chrome Extension

In the end...

There are many web tools that allow you to download an entire GitHub repo or part of it.

DownGit
Create GitHub Directory Download Link

Personally, I prefer using the official GitHub website for downloading the repository or a file. But it's good to see various open source tools to help you download folders, too.

Keep learning, keep coding, keep GitHubing πŸ˜„