How to Clone a Github Repository with VS Code (Example)

Visual Studio Code (VSCode) is a code editor that helps you to develop, run and debug code with built-in syntax highlighting, code completion and commit features.

In this post, I will show how you create, clone and work with your Github repository in VSCode.

Install Visual Studio Code

  1. If you have not already done so, install VS Code.
  2. If you wish, you can also take the additional steps to set-up VSCode with Python.

Install and Activate Git and Github

Before you can use Git and Github in VSCode, you need to :


Subscribe to my Newsletter


  1. Create a Github account;
  2. Install Git on your computer.

If you want detailed instructions on how you can create and set-up Git and Github, read how to install and set-up Git in VSCode.

If you know how, you can also just go to Git Download location.

Create a Github Repository

Next, you need to create a Github repository. You can do so by following one of these tutorials:

  1. Create a Github Repository From VSCode
  2. Create a Github Repository From Github

Clone Your Repository in VSCode

Now it is time to clone your Github Repository with VSCode.

To clone your repository, you need to copy the web URL linked to your repository on Github and clone the repo.

Go to your Github Repository, Click on the <> Code button, and Copy the URL

Go in Visual Studio Code.

Open the command palette. Press Ctrl+Shift+P (Windows), or Command+Shift+P (Mac). This will replicate what you would do from the command line.

Type Git: Clone.

Clone Your Github Repository from VS Code

Add the URL that you copied earlier.

Copy the Github URL

Select the repository location where you want your file to be cloned (folder on your desktop).

A small prompt window will pop-up in the bottom right of your screen saying: “Would you like to open the cloned repository?”. Click on “Open”.

Go to your working folder, your repository should be cloned.

Open the Project in VSCode

If you have not opened the newly created project in VSCode when you were ask if you wanted to open the repository earlier, now it is time to do it.

Click on File > Open, go to the cloned repository and click on “Open”.

Conclusion

Congratulations, you have cloned your first Github repository from VSCode. You are now ready to learn how to push code from Visual Studio Code to Github.

Other Version Control with Git and Github Posts

Learn Git and Github (Complete Guide)
Get Started With Github
Basics of Version Control
Enjoyed This Post?