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 code projects. Information technology's besides completely free to utilise for individuals and if a repository is public, anyone can clone it and use the files within.

GitHub is used for a variety of reasons, non least as a mode to distribute your own code. One of the absolute nuts is cloning a repository from GitHub to your local automobile. If y'all've never washed this earlier it could seem like a strange concept, simply information technology'southward really easy to do.

Whether you want to use regular quondam 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 Central

The primary tool yous'll exist using with GitHub is Git. This can be confusing, but Git is the tool and GitHub is the service that interacts with it; Git is completely divide and has nothing to exercise with Microsoft.

The basic definition of Git is that it's a version control tool, allowing multiple people to interact with the same files independently with the option to merge changes into the main co-operative.

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

To install Git on Windows you can simply go to the website and download the executable, or if you want to use the Windows Package Director, open up up a new PowerShell window and enter winget install git.

In WSL distros similar Ubuntu and Debian you can install Git using the control sudo apt install git. It should already exist installed when y'all prepare up your WSL installation, only if it isn't this command is all you need.

On Windows, the Git installation will come up with its own concluding. You tin use this if y'all wish, but yous tin can also just collaborate with it within PowerShell. Especially if it's an environment y'all'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 well-nigh bones functions of Git and one that y'all can employ happily without getting in the weeds as well much if all you're interested in is beingness able to pull content from GitHub. Cloning is essentially downloading, in so much equally you lot betoken your local Git client at the destination on GitHub and it will pull the content downwards, creating a new directory on your local automobile.

Whether yous're working within PowerShell using Git for Windows or you're inside WSL, the commands you need are the same. Git is platform-agnostic, so you can learn it in one case and use it everywhere.

When you clone the repo in the terminal, it will create your local folder inside any directory your command line is in at that point. So if you want to put it somewhere specific, find the right location in File Explorer then right-click and open up in PowerShell/Windows Terminal. WSL distros can also admission the Windows filesystem and then if yous're using Linux on your Windows box, the same idea applies. It will simply save to the Linux file system if you tell it to.

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

Github Source: Windows Central

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

    Github Source: Windows Key

  4. Copy the URL.
  5. Open up your chosen concluding. Whether it'southward 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. Information technology doesn't choice and choose; you lot become the whole lot. You'll also get 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 accept a local re-create of a GitHub repository, just what if it gets updated? Everything you pull from GitHub will be an initialized Git repository, with files inside that allow information technology to interact with Git, and in turn, let you to pull updates. Information technology allows much more but as this tutorial is just focused on cloning, updates are all we're interested in.

To get the latest update to a GitHub repository, open up your final within the folder y'all initially cloned (using the steps to a higher place if it's easier) and enter git pull. That's all there is to it, and Git will at present compare your copy of the repository to that hosted on GitHub and volition download whatsoever changes.

You now know how to clone and pull updates from any GitHub repository. Unless you have the right permissions you won't be able to make any changes to the hosted files, so annihilation 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: cartiertoloses.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