Skip to content

Latest commit

 

History

History
241 lines (134 loc) · 11.8 KB

File metadata and controls

241 lines (134 loc) · 11.8 KB
title Tutorial: Open project from repo in Visual Studio
description In this tutorial, learn how to open a cloned project in a Git or Azure DevOps repository by using Visual Studio and view files in Solution Explorer.
ms.date 02/27/2026
ms.subservice general-ide
ms.topic tutorial
author MikeJo5000
ms.author mikejo
dev_langs
CSharp
ms.custom
vs-acquisition
sfi-image-nochange

Tutorial: Open a project from a repo

In this tutorial, you use Visual Studio to connect to a repository, or repo, for the first time, clone it, and then open a project from it.

In this tutorial, you learn how to:

[!div class="checklist"]

  • Open a project from a GitHub repo
  • Browse to an Azure DevOps repo

Prerequisites

::: moniker range="visualstudio"

Open a project from a GitHub repo

Visual Studio makes it easy to open a project from a repo. You can do so when you start Visual Studio, or you can do so directly from within the Visual Studio IDE.

Here's how.

Use the start window

  1. Open Visual Studio.

  2. On the start window, select Clone a repository.

    :::image type="content" source="media/visualstudio/clone-repository.png" alt-text="Screenshot of the Clone a Repository dialog in Visual Studio." lightbox="media/visualstudio/clone-repository.png":::

  3. Enter or type the repository location, and then select Clone.

    :::image type="content" source="../ide/media/vs-2022/clone-repository-enter-location.png" alt-text="Screenshot of the Clone a Repository dialog in Visual Studio where you enter a Git repo URL." lightbox="../ide/media/vs-2022/clone-repository-enter-location.png":::

  4. If you're not already signed in, you might be prompted to sign into Visual Studio or your GitHub account.

    [!TIP] For more information about signing in to Visual Studio, see Sign in or switch Visual Studio user accounts. For specific information about how to use your GitHub account to sign in, see Add your GitHub accounts to your Visual Studio keychain. You might receive a trust notification. For more information, see Configure trust settings for files and folders.

View files in Solution Explorer

Visual Studio loads the solutions from the repository by using the Folder View in Solution Explorer.

:::image type="content" source="./media/visualstudio/git-solution-explorer-folder-view.png" alt-text="Screenshot of the Folder View in Solution Explorer in Visual Studio.":::

You can view a solution in Solution View by double-clicking its .sln file.

You can select Switch Views to switch between folder view and solution view.

:::image type="content" source="./media/visualstudio/git-solution-explorer-switch-views.png" alt-text="Screenshot of a C# project in Git that's open in Solution Explorer.":::

Tip

You can change from the default Folder View to Solution View from the Git menu. Select Settings > Source Control > Git Global Settings > Automatically load the solution when opening a Git repository.

Open a project locally from a previously cloned GitHub repo

  1. Open Visual Studio.

  2. On the start window, select Open a project or solution.

    Visual Studio opens an instance of File Explorer, where you can browse to your solution or project, and then select it to open it.

    :::image type="content" source="./media/visualstudio/open-local-project-from-cloned-repo.png" alt-text="Screenshot of the 'Open a project or solution' window in Visual Studio.":::

    [!TIP] If you opened the project or solution recently, select it from the Open recent section.

    Start coding!

Use the IDE

You can also use the Git menu or the Select Repository control in the Visual Studio IDE to interact with a repository's folders and files.

Here's how.

To clone a repo and open a project

  1. In the Visual Studio IDE, select the Git menu, and then select Clone Repository.

    :::image type="content" source="./media/visualstudio/git-menu-clone-repository.png" alt-text="Screenshot of the Git menu in Visual Studio with Clone Repository selected.":::

  2. Follow the prompts to connect to the Git repository that includes the files that you're looking for.

To open local folders and files

  1. In the Visual Studio IDE, select the Git menu, select Local Repositories, and then select Open Local Repository.

    :::image type="content" source="./media/visualstudio/git-menu-local-repositories.png" alt-text="Screenshot of the Git menu in Visual Studio with the Local Repository and Open Local Repository showing.":::

  2. Follow the prompts to connect to the Git repository that has the files that you're looking for.

Browse to an Azure DevOps repo

Here's how to browse to and clone an Azure DevOps repo by using Visual Studio.

  1. Open Visual Studio.

  2. On the start window, select Clone a repository.

    :::image type="content" source="./media/visualstudio/clone-repository.png" alt-text="Screenshot of the Clone a Repository dialog in Visual Studio, for Azure DevOps." lightbox="./media/visualstudio/clone-repository.png":::

  3. In the Browse a repository section, select Azure DevOps.

    :::image type="content" source="../ide/media/vs-2022/browse-repository-azure-devops.png" alt-text="Screenshot of 'Browse a repository' in the 'Clone a repository' dialog in Visual Studio, Azure DevOps highlighted.":::

  4. Follow the prompts to clone an Azure DevOps repo that includes the files that you're looking for, and then open your project.

::: moniker-end

::: moniker range="vs-2022"

Open a project from a GitHub repo

Visual Studio makes it easy to open a project from a repo. You can do so when you start Visual Studio, or you can do so directly from within the Visual Studio IDE.

Here's how.

Use the start window

  1. Open Visual Studio.

  2. On the start window, select Clone a repository.

    :::image type="content" source="../ide/media/vs-2022/clone-repository.png" alt-text="Screenshot of the Clone a Repository dialog in Visual Studio." lightbox="../ide/media/vs-2022/clone-repository.png":::

  3. Enter or type the repository location, and then select Clone.

    :::image type="content" source="../ide/media/vs-2022/clone-repository-enter-location.png" alt-text="Screenshot of the Clone a Repository dialog in Visual Studio where you enter a Git repo URL." lightbox="../ide/media/vs-2022/clone-repository-enter-location.png":::

  4. If you're not already signed in, you might be prompted to sign into Visual Studio or your GitHub account.

    [!TIP] For more information about signing in to Visual Studio, see Sign in or switch Visual Studio user accounts. For specific information about how to use your GitHub account to sign in, see Add your GitHub accounts to your Visual Studio keychain. You might receive a trust notification. For more information, see Configure trust settings for files and folders.

View files in Solution Explorer

Visual Studio loads the solutions from the repository by using the Folder View in Solution Explorer.

:::image type="content" source="./media/vs-2022/tutorial-open-project-from-repo/git-solution-explorer-folder-view.png" alt-text="Screenshot of the Folder View in Solution Explorer in Visual Studio 2022.":::

You can view a solution in Solution View by double-clicking its .sln file.

You can select Switch Views to switch between folder view and solution view.

:::image type="content" source="./media/vs-2022/tutorial-open-project-from-repo/git-solution-explorer-switch-views.png" alt-text="Screenshot of a C# project in Git that's open in Solution Explorer":::

Tip

You can change from the default Folder View to Solution View from the Git menu. Select Settings > Source Control > Git Global Settings > Automatically load the solution when opening a Git repository.

Open a project locally from a previously cloned GitHub repo

  1. Open Visual Studio.

  2. On the start window, select Open a project or solution.

    Visual Studio opens an instance of File Explorer, where you can browse to your solution or project, and then select it to open it.

    :::image type="content" source="../ide/media/vs-2022/open-local-project-from-cloned-repo.png" alt-text="Screenshot of the 'Open a project or solution' window in Visual Studio 2022.":::

    [!TIP] If you opened the project or solution recently, select it from the Open recent section.

    Start coding!

Use the IDE

You can also use the Git menu or the Select Repository control in the Visual Studio IDE to interact with a repository's folders and files.

Here's how.

To clone a repo and open a project

  1. In the Visual Studio IDE, select the Git menu, and then select Clone Repository.

    :::image type="content" source="../ide/media/vs-2022/git-menu-clone-repository.png" alt-text="Screenshot of the Git menu in Visual Studio 2022 with Clone Repository selected.":::

  2. Follow the prompts to connect to the Git repository that includes the files that you're looking for.

To open local folders and files

  1. In the Visual Studio IDE, select the Git menu, select Local Repositories, and then select Open Local Repository.

    :::image type="content" source="../ide/media/vs-2022/git-menu-local-repositories.png" alt-text="Screenshot of the Git menu in Visual Studio 2022 with the Local Repository and Open Local Repository showing.":::

  2. Follow the prompts to connect to the Git repository that has the files that you're looking for.

Browse to an Azure DevOps repo

Here's how to browse to and clone an Azure DevOps repo by using Visual Studio.

  1. Open Visual Studio.

  2. On the start window, select Clone a repository.

    :::image type="content" source="../ide/media/vs-2022/clone-repository.png" alt-text="Screenshot of the Clone a Repository dialog in Visual Studio, for Azure DevOps." lightbox="../ide/media/vs-2022/clone-repository.png":::

  3. In the Browse a repository section, select Azure DevOps.

    :::image type="content" source="../ide/media/vs-2022/browse-repository-azure-devops.png" alt-text="Screenshot of 'Browse a repository' in the 'Clone a repository' dialog in Visual Studio, Azure DevOps highlighted.":::

  4. Follow the prompts to clone an Azure DevOps repo that includes the files that you're looking for, and then open your project.

::: moniker-end

Related content

Feel free to dive into any of the following language-specific tutorials:

For more information, see:

::: moniker range=">=vs-2022"

::: moniker-end