How to Download from GitHub (File, Project, Code, Repository)
Mục lục bài viết
Why use Github?
GitHub is a software hosting service as well as a social networking site for programmers and software companies. Developers can easily pull files from GitHub, collaborate, edit, manage, and share code.
The devs can also keep track of changes made by other users to the code files in an organized manner so they can later undo the change if needed.
The DevOps on GitHub can also contact other developers for help, reuse publicly available code for their projects, and download files and codes from GitHub. But unlike other social media platforms, GitHub is different and isn’t straightforward. It can make new users struggle with using GitHub to its fullest potential.
Things to do before you download from GitHub
Here are a few things that you need to do before you download a file or a desired repository from GitHub:
- Check “Releases”: Checking the “Releases” helps confirm you’re downloading the correct version of the file, the code, or the program. It maintains detailed documentation of each version of the software and the changes that were made.
- Check “Read Me”: The “Read Me” section speaks about the project and sometimes even gives instructions on how to use it. Before you download a file or the code from a project’s repo, read the “Read Me” section properly.
- Open the project website: If the “Read Me” file isn’t included, look for a link to the company’s project website. You will download the software from a verified source and learn more about the software and its features.
Method 1: How to download GitHub files?
Here’s how to download GitHub files:
Step 1) Open the repository page to see where the file is stored. Login to GitHub if the repository is private. Otherwise, you can proceed without logging in.
Step 2) Locate the file you want to download from the repository page.
Step 3) Open the file by clicking on it.
Step 4) Click the “Raw” button on the top-right corner of the GitHub page. The raw code of the file will now open in your browser.
Step 5) On your mouse, press the right-click button on the page and choose “Save as.” Give the file a name, select a location where you want to save the file, and click on “Save.”
Method 2: Downloading GitHub Files Using Commands
Here’s how to download files from GitHub using commands:
Step 1) Firstly, download and install Git Bash on your PC.
Step 2) Now, open your browser and select the repository from which you want to download files.
Step 3) Click the green “<> Code” button on the top-right corner.
Step 4) Copy the URL from the “HTTPS” tab.
Step 5) Open Git Bash and enter the command “cd downloads”.
Step 6) Type the command “git clone” and paste the link you copied, then press “Enter” on your keyboard. For example, “git clone https://github.com/bdward16/JavaScript30.git“
Step 7) The files will now start downloading to the “Downloads” folder.
Method 3: How to Download a Folder from GitHub?
GitHub doesn’t have the option to let users download a folder like it has the option to download a file. To circumvent this restriction, GitHub users have built their solution.
A few GitHub users have built a website where you paste the link to the GitHub folder, and the folder will start downloading.
Download Directory is a trustworthy site that you can use to download a GitHub folder.
Method 4: How to download the GitHub repository?
Downloading a repository is simple. Follow the below steps to learn how:
Step 1) Click “Code” located on the top-right corner of the repository page, and click “Download Zip” to download the repository.
Step 2) Your device will download a zipped file that contains the entire repository.
Note: Depending on the size of the repository, download can same time.
Step 3) Extract the zip file to access all the different files in the repository.
Method 5: How to download multiple files from GitHub?
GitHub doesn’t have a straightforward method to download multiple files. Users should download the whole repository, remove the files they don’t need, and keep the files they do need. This is the only method to “download multiple files” off GitHub.
Method 6: How to download Releases from GitHub?
Here’s how to download a release from GitHub:
Step 1) Open a release from the “Releases” panel on the right.
Step 2) Under “Asset,” click “Source code (zip)” to download a zip file of the “Releases.”
Method 7: Download a CSV file from GitHub
Here’s how to download a CSV file from GitHub:
Step 1) Open the repository and select the CSV file you want to download.
Step 2) After the file has opened, click “Raw” in the top right corner.
Step 3) A new window will open; right-click on the page and select the option “Save As.”
Step 4) Give a name to the file and also select where you want to save it, then click “Save.”
Step 5) Now, go to the location where you saved the file and open it to access it.
Method 8: How to clone and fork a repository on GitHub?
If you want to create your own copy of the repository at a different location to make changes, forking is the best option. It lets you make edits without causing changes to the original repository. Cloning, on the other hand, clones the repository, that will continuously synch with the original.
Here’s how to fork a repository:
Step 1) Sign into your GitHub account.
Step 2) Open the repository you want to fork and click the “Fork” option in the top-right corner.
Step 3) Now select the option “Create fork.”
Step 4) Allow a few seconds, and the process will be completed.
Here are steps to clone a repository:
Step 1) Open the repository you want to clone.
Step 2) Click on “Code” and copy the URL under the HTTPS tab.
Step 3) Open Git Bash and type “cd downloads” to change the cloning destination to the “Download” folder.
Step 4) Now, type “git clone” and paste the URL.
Step 5) Press your keyboard’s “Enter” key to begin cloning.
Method 9: How to download an archive of your GitHub data
Here’s how to download an archive of your GitHub data
Step 1) Click on your profile to expand the options.
Step 2) Select “Settings.”
Step 3) Now, select “Account.”
Step 4) Under “Export account data,” click “Start export.”
Step 5) Open your email account and click “Download export.”
Step 6) The download will begin.