Edit

Share via


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:

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

Prerequisites

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.

    Screenshot of the Clone a Repository dialog in Visual Studio.

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

    Screenshot of the Clone a Repository dialog in Visual Studio where you enter a Git repo URL.

  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.

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.

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.

    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.

    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.

    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.

    Screenshot of the Clone a Repository dialog in Visual Studio, for Azure DevOps.

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

    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.

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

For more information, see: