Keeping a track of your changes and their history is very important for a developer. GitHub is a code hosting platform for version control and collaboration. It lets you and others work together on projects from anywhere.
In this post, we will clone our code from the created repository in GitHub using Visual Studio. Check out my previous post where we saw How to Create GitHub Repository?
Pre-requisites
- Visual Studio
- GitHub Account
The visual Studio download link can be found on the downloads page.
Clone your Code from GitHub using Visual Studio(VS)
I hope you have the repository ready in GitHub that we can clone it. You may have a similar repo like this as shown below. I will clone a Console Application.

Open your Visual Studio. On the Home Screen, click on Clone a Repository
. I will be working on Visual Studio 2022 Preview. There is no change in the Visual Studio 2019 steps.

You can clone the repo in two ways –
- Clone it using the Repository Link
- Clone it using the GitHub option in Visual Studio
Clone GitHub Repository in Visual Studio using Repository Link
Click on Code in the GitHub repository and copy the GitHub repo URI.

In Visual Studio, paste the URL and choose the local directory path where you want to clone the GitHub repository. Click on Clone
.

That is it. If you see a blue lock symbol against your files and folders, that means you have successfully cloned your GitHub repository from Visual Studio using the Repository link. If you are asked to log in to GitHub from a small pop-up dialog window, log in. This is required for Private GitHub Repos.

Learn to push back your code changes to GitHub from another post here.
Clone GitHub Repository in Visual Studio using GitHub Option
On Visual Studio Startup, click on Clone a Repository. This time, click on the GitHub option.

If you are cloning from GitHub for the first time in VS, click on Sign in
and choose GitHub Account. If you are already logged in to GitHub in your browser, the authentication will be successful automatically.

Choose a repository and select the local path where you want to clone. Click on Clone.

That is it. If you see a blue lock symbol against your files and folders, that means you have successfully cloned your GitHub repository from Visual Studio using the GitHub option.

Learn to push back your code changes to GitHub from another post here.
Leave a Reply