Create a local Git Repository in Visual Studio 2019

A Git repository, or repo, is a folder that you’ve told Git to help you track file changes in. You can have any number of repos on your computer, each stored in their own folder. Each Git repo on your system is independent, so changes saved in one Git repo don’t affect the contents of another.

A Git repo contains every version of every file saved in the repo. Git saves these files very efficiently, so having a large number of versions doesn’t mean that it uses a lot of disk space. Storing each version of your files helps Git merge code better and makes working with multiple versions of your code quick and easy.

This blog post shows how to create a local Git repository and create a simple Visual Basic application that runs on the console.

Open Visual Studio Installer and choose Launch


On the start window, choose Continue without code.


From the main menu navigate to File > New > Repository

In the Team Explorer, under Local Git Repositories, select
New and enter a folder where the repo will be created. This directory must be empty. Select Create to create the repo.

Your new local Git repository is now Created.


Create a new solution under local Git version control

Right-click on the new local Git repository you created and click Open.


In the Team Explorer, under Solutions, select New


On the Create a new project window, choose the Console App (.NET Core) template, and then choose Next.


In the Configure your new project window, type or enter WhatIsYourName in the Project name box. Then, choose Create.


Visual Studio opens your new project.

Create the application

After you select your Visual Basic project template and name your project, Visual Studio creates a simple “Hello World” application for you. It calls the WriteLine method to display the literal string “Hello World!” in the console window.



4 thoughts on “Create a local Git Repository in Visual Studio 2019

  1. It seems that there is also a method of creating a solution first, and then creating a repository from Solution Explorer.
    From the context menu of the solution node, there is a menu item that adds the solution to source control.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s