How To Download Files From GitHub
GitHub is an online repository for developers to post code and programs. There are a lot of useful files in the repository, but it isn’t the most user-friendly software. Especially people who aren’t tech-savvy will struggle with finding files and downloading them.
So if you’re not entirely sure how you can download files from projects (or entire projects) from GitHub, we’ll show you how. Let’s get started.
Downloading a File From GitHub
Most public repositories can be downloaded for free without even a user account. This is because public repositories are codebases that are open source. That said, unless the owner of the codebase checks a box otherwise, their codebase can be downloaded onto your computer, and packed into a .zip file.
- If you already have a link — such as this Tip Calculator — you’ll notice that in the top-right corner is a green button that says Code; click on the button.
- Then, in the dropdown, select Download ZIP. All of the files will begin downloading to your computer, usually in your Downloads folder.
- Then, open your Downloads folder on your computer and find the ZIP file. You’ll want to right-click it and choose the option that says Extract All…, Unzip, or Uncompress, and then select a folder where you want the files to end up.
- Finally, navigate to that selected folder, and you’ll find all of those Github files we downloaded right there!
Downloading GitHub Files Using Commands
Alternatively, you can easily clone a file or repository using a few simple commands on GitHub. For this to work, you’ll need to install the Git tools. We will be installing the same tip calculator from the command line in this demo.
- Copy the URL from your address bar or from the same menu where you downloaded the zip file.
- Open up Git Bash, type in “cd Downloads,” and hit Enter. This will take you to the Downloads folder in the command window; you can also type whatever file location you want to save the file.
- Now, type in “git clone https://github.com/bdward16/tip-calculator.git” and hit Enter.
- Using this method, the files are automatically unzipped when downloaded.
There’s a Better Way to Download Files
While the way we outlined is simple and straightforward, it’s most optimal for simply viewing the code files, not experimenting. If you’re planning on downloading GitHub files to experiment with, the best way would be to “fork” the project. A fork is simply your own copy of a repository.
Forking a repository comes with a number of benefits. It gives you your own copy on your GitHub account, which allows you to freely experiment with changes without affecting the original project. For example, you could find a bug in my Tip Calculator or want to add your own features. So, you could “fork” my Tip Calculator, creating a copy on your GitHub account. Here, you could mess around with the code and experiment with it without affecting the original project because this would be your copy or “fork.”
Most commonly, forks are used to propose changes to someone else’s project, like fixing a bug or adding a feature, as we mentioned.
So, how do you fork a public repository? It’s quite easy. Before we start, you need to create a free GitHub account, as you’ll need somewhere to store your fork. You can head to www.github.com and do this right now.
Once you have your account created, you can fork a public repository to your account.
- It could take a couple of seconds to a few minutes, but GitHub will then clone or “fork” that project over to your own GitHub account. Once done, it’ll immediately show you the project under your GitHub username.
Now, you can change and experiment with the code all you want, and it won’t affect the original project files of the original owner. If you change some code, fix a bug, or add a new feature, you can create something called a “Pull Request,” where that change can be discussed. If the original project owner likes the change — and it works properly — it can be merged into the original codebase as production code.
Tips for Finding Files
A simple Google or Reddit search will lead you directly to the files you need. But, if you open GitHub, you can search for files to download. Here’s how:
- Open GitHub and click Search GitHub in the upper right corner.
- Type the file name, developer, or whatever you’re look for, and click Enter.
- Scroll through the list until you find the one you want to download.
Tip: Use the sorter in the upper right corner to select the ones with best stars, recent updates, etc.
Frequently Asked Questions
Here are the answers to more of your questions about GitHub.
How do I know which files are safe to download?
GitHub is merely an online repository meaning people can upload whatever code they’d like for you to download. It’s best to be leery before downloading anything from GitHub. But there are some indicators that the files are trustworthy.
Check the number of stars, number of contributors, and new releases. If the contributors maintain the software and it has good ratings (from a lot of people), it’s likely safe.
I can’t find the installation zip file. What do I do?
If you’ve installed the files and can’t find an important one, like an installation file, go back to the GitHub page where you downloaded the data. Click the Issue tab and click New Issue.
Let the developer know you’re missing a file and they should respond.
As you can see, downloading files and whole projects from GitHub is actually quite easy. In just a few minutes, you can have an entire project downloaded onto your computer or even forked to your own GitHub account. It doesn’t take much to mess around with the code in your fork to see what affects what, and then eventually, you might even be able to create your first pull request! Happy coding!