Current Setup

  • An existing Visual Studio project without any source control links.
  • An existing DevOps project with default Repo

Step 1 – Open up existing Visual Studio project and create a local Git Repo

  1. Create a new local Git repo for your Visual Studio solution, by right-clicking the solution name in Solution Explorer, and then selecting Create Git Repository.
  2. In the Create a Git repository window, choose Local only, verify the local path is correct, and then choose Create.

You’ve now created a local Git repo in the Visual Studio solution folder and committed your code into that repo. Your local Git repo contains both your Visual Studio solution and Git resources.

Screenshot of the Git folder, Git ignore file, and Git attributes file in Windows file explorer.

Note: The “Create a Git repository” option may be hidden if you have a current project open that is already connected to a repository. If the option is hidden, close Visual Studio, and reopen open Visual Studio without a project.

Step 2 – Push to Git Service

  1. Connect to an Azure DevOps repo by right-clicking the solution name in Solution Explorer, and then selecting Push to Git service to launch the Create a Git repository window.
  2. In the Create a Git repository dialog, select Existing Remote. Select the repo of your DevOps project. Then select Push.

https://org01@dev.azure.com/org01/TestDevOps01/_git/TestDevOps01

Sources:

https://learn.microsoft.com/en-us/azure/devops/repos/git/share-your-code-in-git-vs?view=azure-devops&tabs=visual-studio-2022

Last modified: December 16, 2022

Author

Comments

Write a Reply or Comment