Create a Git repository from Visual Studio
Applies to: Visual Studio Visual Studio for Mac
Note
This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here
Visual Studio makes it easy to create a repo right from the IDE. Repository creation from Visual Studio is optimized for GitHub, but you can work remotely with the Git provider of your choice. Here's how.
Prerequisites
To follow this article, you'll need:
Create a GitHub repo
Open Visual Studio, and then select Create a new project.
Tip
If you don't already have a project in Visual Studio to add to a repo, you can quickly create a new C# console app and name it MyNewApp. Visual Studio populates your new app with default "Hello, World!" code.
From the Git menu, select Create Git Repository.
In the Create a Git repository dialog, under the Push to a new remote section, choose GitHub.
In the Create a new GitHub repository section of the Create a Git repository dialog, enter the name of the repo you want to create.
Tip
If you haven't yet signed in to your GitHub account, you can do so from this screen, too.
After you sign in and enter your repo info, select the Create and Push button to create your repo and add your app.
Open an existing local repository
After you’ve created a repo or cloned one, Visual Studio detects the Git repository and adds it to your list of Local Repositories in the Git menu. From there, you can quickly access and switch between your Git repositories.
Create an Azure DevOps repo
Open Visual Studio, and then select Create a new project.
Tip
If you don't already have a project in Visual Studio to add to a repo, you can quickly create a new C# console app and name it MyNewApp. Visual Studio populates your new app with default "Hello, World!" code.
From the Git menu, select Create Git Repository.
In the Create a Git repository dialog, under the Push to a new remote section, choose Azure DevOps.
In the Create a new Azure DevOps repository section, sign in to your Azure account, and then select a project from the Project drop-down list.
Select the Create and Push button to create your repo and add your app.
Next steps
To continue your journey, visit the Create a branch page.