Topic 3

Clone

Choose the clone workflow that matches where you are starting from. There are three ways to clone repositories in GitHub.

First way

Open the Source Control view, choose Clone Repository, and select Clone from GitHub.

VS Code welcome screen for starting a clone workflow

Search for the repository you want to clone.

VS Code repository picker with GitHub repositories listed

If VS Code asks for a repository source, choose Clone from GitHub.

VS Code clone source picker with Clone from GitHub selected

Select the repository from the GitHub search results.

VS Code repository picker with a GitHub repository selected

Choose a destination folder for the clone before moving any project files.

Folder selection dialog for choosing a clone destination

After the clone finishes, open that cloned repository as the working folder before copying your project files into it.

VS Code after opening the cloned repository

Once the folder cloning is completed successfully, you will be able to see the following screen.

VS Code showing the cloned repository open in the Explorer

Second way

Copy the repository URL from GitHub.

GitHub repository page with the repository URL copy button highlighted

You can also paste the repository URL copied from GitHub directly into VS Code.

VS Code clone input for pasting a GitHub repository URL

Third way

Enter these commands in the terminal.

git clone <repository-url>
cd <repository-folder>

Fork

If you want to copy someone else’s public repository, use Fork.

GitHub repository page with the Fork button highlighted

If the cloned repository is open in VS Code and the project files are inside it, continue to the first commit and push workflow.