banner



How to clone GitHub repos on Windows 10, 11, and WSL

Github Source: GitHub

The Microsoft-owned GitHub platform is the largest of its kind for sharing and collaborating on a variety of lawmaking projects. It'southward also completely free to employ for individuals and if a repository is public, anyone tin clone it and use the files within.

GitHub is used for a diversity of reasons, not least equally a style to distribute your ain code. 1 of the absolute basics is cloning a repository from GitHub to your local machine. If you've never washed this before it could seem like a foreign concept, but information technology's actually easy to do.

Whether you lot want to employ regular sometime Windows or the Windows Subsystem for Linux (WSL) this is what you need to know.

Installing Git onto your PC

Git on Windows 11 Source: Windows Primal

The master tool you'll be using with GitHub is Git. This can be disruptive, but Git is the tool and GitHub is the service that interacts with it; Git is completely carve up and has zilch to do with Microsoft.

The bones definition of Git is that it's a version control tool, allowing multiple people to collaborate with the aforementioned files independently with the option to merge changes into the master branch.

Git is also the tool that we'll be using to clone a GitHub repo from the cloud to a local motorcar.

To install Git on Windows you lot can merely get to the website and download the executable, or if you want to use the Windows Package Manager, open up upwards a new PowerShell window and enter winget install git.

In WSL distros like Ubuntu and Debian you can install Git using the command sudo apt install git. Information technology should already be installed when you set up your WSL installation, but if information technology isn't this control is all you need.

On Windows, the Git installation will come with its ain terminal. You lot can employ this if you wish, simply yous can also only interact with it inside PowerShell. Peculiarly if information technology's an environment you lot're already comfortable with.

How to clone a GitHub repo to your PC

Cloning a GitHub repo Source: Windows Central

Cloning is one of the nigh basic functions of Git and 1 that y'all can utilize happily without getting in the weeds too much if all you're interested in is being able to pull content from GitHub. Cloning is essentially downloading, in so much equally you point your local Git client at the destination on GitHub and it will pull the content down, creating a new directory on your local machine.

Whether y'all're working within PowerShell using Git for Windows or you lot're inside WSL, the commands you need are the aforementioned. Git is platform-doubter, so you can learn it one time and utilize it everywhere.

When you lot clone the repo in the concluding, it will create your local folder within whatever directory your control line is in at that point. And so if you lot desire to put information technology somewhere specific, find the right location in File Explorer then right-click and open in PowerShell/Windows Final. WSL distros can also access the Windows filesystem so if you're using Linux on your Windows box, the same thought applies. Information technology volition only save to the Linux file system if you tell it to.

Cloning from GitHub basically requires you lot to go a web address to feed into the Git customer. For this example, nosotros're going to clone the Microsoft Visual Studio Code repo.

Github Source: Windows Central

  1. Detect the repo you want on the GitHub website. For this case, we're using https://github.com/microsoft/vscode
  2. Click the push button labeled Code.
  3. Select HTTPS.

    Github Source: Windows Central

  4. Copy the URL.
  5. Open upward your chosen terminal. Whether it's WSL or PowerShell the Git commands are the same.
  6. In the terminal enter git clone https://github.com/microsoft/vscode

Git will now pull the entire contents of the called repository down to your local machine. It doesn't pick and choose; yous get the whole lot. You'll as well go the README.md file which is used to create any text and instructions on the front end page of the repo.

Git Pull Source: Windows Central

Y'all now have a local re-create of a GitHub repository, but what if it gets updated? Everything you pull from GitHub volition be an initialized Git repository, with files inside that allow it to interact with Git, and in plow, allow you to pull updates. It allows much more than just as this tutorial is only focused on cloning, updates are all we're interested in.

To get the latest update to a GitHub repository, open up upwardly your terminal inside the folder you initially cloned (using the steps to a higher place if information technology's easier) and enter git pull. That's all in that location is to it, and Git volition now compare your copy of the repository to that hosted on GitHub and will download any changes.

You now know how to clone and pull updates from any GitHub repository. Unless you lot take the right permissions yous won't be able to make any changes to the hosted files, so anything you do locally is totally fine. Go forth and clone!

Source: https://www.windowscentral.com/how-clone-github-repos-windows-10-11-and-wsl

Posted by: jacksonackles94.blogspot.com

0 Response to "How to clone GitHub repos on Windows 10, 11, and WSL"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel