Git in Visual Studio - add existing project?

niico picture niico · May 30, 2013 · Viewed 183.3k times · Source

I'm trying to put an existing project under Git source control, but I'm unclear on several things.

I have set up a 'Team Foundation Service' Git account online.

I currently have an ASP.NET MVC 4 solution - in my Projects folder. I have created a Git 'repository' locally (an empty folder currently). Should this just be my current application folder in Projects? Or does it need to be a copy?

How do I get my existing files into the online repository?

Answer

airbear picture airbear · Nov 23, 2013

I went searching around for a similar question - the way I've managed to initialize a Git repository for an existing project file is this (disclaimer: this is done in Visual Studio 2013 Express, without a Team Foundation Server setup):

  1. Open the project in Visual Studio.
  2. Go to menu FileAdd to Source Control.

That did it for me - assuming Git is set up for you, you can go to menu ViewTeam Explorer, then double click the repository for your project file, and make your initial commit (making sure to add whatever files you'd like).