How to download from GitHub
Getting involved in open source software or web development is a core part of any programmer’s learning journey. GitHub is by far the most popular platform that hosts open source projects, so understanding how to download from GitHub is an essential skill any aspiring developer should have.
Open source development and GitHub go hand in hand. The two are practically synonymous. Getting involved in open source projects can be hugely rewarding for aspiring professional developers. Being able to contribute to projects you’re passionate about, while learning from like-minded and more experienced people, all in your own time – wherever it suits you, is a phenomenon few other industries support.
To the uninitiated, GitHub can seem a little intimidating and at times unintuitive, but downloading from the platform is straightforward. With our guide, you’ll be up and running in no time.
Mục lục bài viết
How to download a repository from GitHub
Public repositories contain open source codebases users can download for free. They don’t even need a GitHub account.
Follow these steps to download an open source database:
- Navigate to GitHub’s website
(opens in new tab)
- Click ‘Explore’ on the top left corner of the page
- In the ‘Explore GitHub’ menu, select ‘Topics’
- Pick a topic from the featured list of topics. GitHub will list all public repositories matching the selected topic. You may also choose to filter the repositories based on programming language, sort by most stars, and more
- Click on the desired repository
- Navigate to the ‘<>Code’ tab
- Click on the ‘Code’ button on the right. A dropdown should appear
- In the ‘Clone’ menu, under the ‘HTTPS’ tab, click on ‘Download ZIP’
(Image credit: IT Pro)
The chosen repository will download as a ZIP file. Once the repository installs on your device, use the ‘README.md’ file for setup and use instructions.
Note: It’s not always possible to download private repositories from GitHub, as they’re only visible to the repository owners and collaborators.
If you wish to contribute to a project and push changes to the original code, forking a repository is the way to go. According to GitHub, ‘a forked repository differs from a clone in that a connection exists between your fork and the original repository itself.’
Forking allows you to experiment or change a file on your computer without affecting the original repository. You may choose to propose changes to the original repository via pull requests, which are subject to the project owner’s approval. Keep in mind that you need an active GitHub account to access fork and pull request features.
How to download a release from GitHub
(Image credit: IT Pro)
Located inside repositories, project maintainers will often package up their projects, making them available to a wider audience to download and use for themselves. These are more akin to typical software downloads rather than a repository which involves downloading all the project’s files to then iterate on or otherwise modify in an integrated development environment (IDE).
Releases mark a specific point in a project’s history. They’re useful to compare how a project has changed over time, or in cases where a new release has been issued to fix a security vulnerability, they can be used as learning tools to see what went wrong and how it was fixed.
Downloading a release from GitHub is a simple process:
Navigate to a repository that has releases available to download. You can find releases in the right navigation pane, beneath the project’s ‘About’ information. You will find links to the most recent release only, or if there are multiple releases, a blue link below the most recent version’s name which leads to a page with all available releases
- Scroll down the page until you find the release you want to download
- Locate the ‘Assets’ dropdown for the desired release. The most recent in the list will already have this expanded, revealing all available files, but older releases usually require the user to click the small white arrow to the left of ‘Assets’ in order to reveal all the files
- Simply clicking on each file will initiate a download
How to fork a repository on GitHub
(Image credit: IT Pro)
It is relatively easy to fork a project on GitHub. Here’s how to do it.
- On GitHub, navigate to your desired public repository.
- Click on ‘Fork’ on the top right corner.
A copy of the original repository will be saved to your GitHub account. Next, you’d create a clone of the fork locally on your computer so the changes remain local to your system.
Use the following steps to create a local clone of your fork:
- Hover over your GitHub username to view repositories
- Navigate to the desired fork or clone of a repository
- Click on ‘Code’ above the list of files
- Click on the copy file URL icon in the clone menu under ‘Clone with HTTPS’ to copy the URL
- Change the current working directory to your preferred directory
- Type ‘git clone’ and paste the URL you copied earlier. For instance, to clone Spoon-Knife repo, use the following command line: ‘$ git clone https://github.com/YOUR-USERNAME/Spoon-Knife’
- Press ‘Enter’
You now have a local copy of your desired repository’s fork. When you’re done making local changes, you can push your local branch to GitHub by initiating a pull request.
Lastly, GitHub also makes it possible to download an archive of your account data. Below are the instructions.
How to download an archive of your GitHub data
- Navigate to your ‘Account Settings’ page
- In the ‘Export account data’ section, click ‘Start export’. GitHub will now send a download link to your primary email address
- Click the download link in your email and re-enter your password if prompted
By default, GitHub packages your account data in a tar.gz file. The download link will automatically expire after seven days. GitHub stores repositories and profile metadata as part of personal account activity
How to download a file from GitHub
(Image credit: IT Pro)
If you’re only looking to download a file from GitHub, instead of a whole repository or archive, then follow these steps.
- Select ‘Go to File’ located at the top of repo contents of the repository you want to download the file from
- You should now be shown a list of all the files located in that repository. Now click the file you want to download, right click the ‘Raw’ button at the top, and then hit ‘Save Link as’. You should now be able to choose the location on your device where you want to save the file to, and the click save to finish the process
How to download multiple files from GitHub
If you’re looking to download multiple files from GitHub, it’s fairly straightforward. There isn’t a way to do this for a group of files, but there are two strategies you can employ.
- If you’re looking for a number of files from a repository, then you’ll have to download a zip folder of the repository and then carefully delete the ones you don’t want
- If you only want a couple of files then you’ll have to download them separately following the process outlined in the section ‘How to download a file from GitHub’
How to download a Folder from GitHub
Just looking to download a folder from GitHub instead of the whole repository? Thankfully, the GitHub community has created a number of tools to help with this. You can use Download Directory (opens in new tab), GitZip (opens in new tab), or even DownGit (opens in new tab).
How to download a CSV from GitHub
Downloading a CSV file from GitHub is very similar to how you would download a normal file.
- Locate the CSV file in the repository
- Right click the Raw button in the GitHub interface at the top
- Choose ‘Save Link As’ and navigate to where you want to save the file
- Click save, and you’re done