Featured Image - How to download a GitHub file, folder, or project

Posted on

by

in

How to download a GitHub file, folder, or project?

Introduction

GitHub has been a code repository of choice for many of the popular open-source projects that power many of the enterprise applications. Anybody can sign up for free and start downloading any project that they want as long as they have access to its repository. In this post, I am going to show you how you can interact with GitHub. I will show you how you can download a file, a folder, or a whole project from any GitHub repository.

If you want to see a demo of this project in raw video format then please see the below video or watch it on my YouTube channel.

How to download a GitHub folder?

Sometimes, a GitHub repository contains lots of files and directories and you are only interested in downloading a particular folder. So what can you do about this? Let us look at an example repository of mine.

For example, my PlatformIO project repository contains self-contained independent project folders that I am grouping per each blog that I am creating.

Sample GitHub Project with multiple folders

If you are interested in downloading only a certain folder then do the following:

  1. Locate the name of the folder that you want to download by clicking the folder name and take note of the URL above. In my case, below is the name of the folder that I want to download.
https://github.com/donskytech/platformio-projects/tree/main/esp32-projects/esp32-dht22
Choose GitHub Folder
  1. Next, navigate to the following site (https://download-directory.github.io/) and paste the URL that you copied in the step above. Press enter.
GitHub folder downloader
  1. After that, it will automatically download the folder in a zip format. You then can use any unzipping utility program like 7-Zip or Winrar if you are on Windows/PC.
GitHub folder downloader - Zip download
  1. Verify the downloaded zip file and open it on your favorite code editor.
Check downloaded GitHub Folder

How to download a GitHub project or repository?

If you have no issues about downloading the whole GitHub project or repository and you want to have a local copy of the whole project on your workstation then you can do the following.

Option 1 – Download the Zip File of the project

  1. Go to the GitHub root page of the project that you want to download. Click the Code button link and Download as Zip file menu.
GitHub Download as Zip
  1. Verify the downloaded project by unzipping it and opening it in your favorite code editor.
GitHub Download as Zip - Verify Download

Option 2 – Download using Git

Another popular option for downloading GitHub projects or repositories is by using the Git client. The formal term is cloning the GitHub repository as you now will be having a local copy of the GitHub project on your workstation. You can even update the code and commit it back to GitHub if you have access. You can follow the steps below on how to clone GitHub repositories.

  1. Download and Install Git client for your own operating system. Some of the Linux distributions have Git preinstalled so you don’t need to install anything but if you don’t have one installed then just go to this site and download the appropriate clients for you and follow the installation steps.
Git Download
  1. Open a terminal or a Git bash terminal if you are on Windows/PC and locate a folder where you want to download the GitHub project or repository. You can also use a command terminal prompt on Windows/PC.
Git Bash Windows or PC
  1. Go to the GitHub repository and copy the Git endpoint of the project that you want to download.
GitHub Git Endpoint
  1. On your terminal, type in the following code.
git clone https://github.com/donskytech/platformio-projects.git
cd platformio-projects
Git Clone

Open the same project on your favorite code editor as it is now downloaded into your workstation file system.

How to download a GitHub file?

Lastly, If you only want to download a specific GitHub file and you don’t want to download the whole project repository or download the specific folder then you can do the following.

  1. Navigate to the GitHub project repository and click the Go To File button.
GitHub Go To File
  1. In the right-hand side of the File Search section, type in the name of the file that you want to see or download. In my case, I am searching for a file with the name “OLED” and it would give me the list of files that match my search terms. Click the file that you want to view.
GitHub Go To Files Search
  1. GitHub will show you the content of the file that you have selected. If you want to save the file to your local file system then you can either click the Raw or Copy or Download the raw file option at the top of the file.
GitHub Download File

Wrap up

In this post, I have shown you several options on how you can download GitHub files and folders from any GitHub repository. As more and more projects are getting added to GitHub then it is equally important to know how to interact with it. So what exciting and cool projects are you going to create with GitHub?

Support Me!

I love sharing what I know and hopefully, I was able to help you. Writing helpful content takes so much time and research. If you think you like my work and I have managed to help you then please consider supporting my channel. I would be very grateful and would boost my confidence that what I am doing is making a big change in the world. (No Pun Intended!) 😉

Become a Patron!
If you like my post then please consider sharing this. Thanks!

6 responses to “How to download a GitHub file, folder, or project?”

  1. Arduino Data Logger using MongoDB Database – donskytech.com

    […] Or if you do not want to download the whole project and are interested only in this particular post then you can follow this How to download a GitHub folder? […]

  2. Exploring ESP-NOW in MicroPython: A Learner's Guide – donskytech.com

    […] The complete code for this project can be found in my GitHub repository of MicroPython projects. If you only want to download the project folder for this post then you can follow this How to download a GitHub folder? […]

  3. Discovering ESP-Now in MicroPython with Asyncio – donskytech.com

    […] The code for this project is available on my GitHub repository and you can download the project folder by following this How to download a GitHub folder? […]

  4. Sensor Data Sharing with ESP-NOW in MicroPython – donskytech.com

    […] The code for this project is available on my GitHub repository. You can download the project folder by following this How to download a GitHub folder? […]

  5. Exploring ESP-NOW with MicroPython and WiFi – donskytech.com

    […] The code for this project is available on my GitHub repository. You can download the project folder by following this How to download a GitHub folder? […]

  6. Controlling your Arduino Projects through Serial Communication – donskytech.com

    […] Or you can download the folder directly by following this How to download a GitHub file, folder, or project? […]

Leave a Reply

Your email address will not be published. Required fields are marked *