Create Git Repo with New Project in Visual Studio 2019

Yes, it's strange, isn't it... not being given the option to save your code to git, when you're creating a new project.

The solution is simple enough though - just click on the "Add to Source Control" item at the bottom-right of the Visual Studio 2019 window.

enter image description here

From there, you are given the option to "Push to Azure DevOps Services", or to a Remote Repository.

What is really cool about this first option is that this sets up everything you'll need in the Azure DevOps site, ready to add Continuous Integration, Pipelines, etc.

And, obviously, you can see the files from your new VS2019 in the "Repos" section of this website.


After creating a new project, I found an option under the File menu called Add to Source Control. That worked for me.


This option has been removed.

See section Remove unnecessary choices in Redesigning the New Project Dialog.

Alternative option is to add to source control option on the status bar (or start with a git init before, or clone from remote*).


* Eg. new (blank) repository in GitHub, Azure DevOps, ...