niico niico - 1 year ago 102
Git Question

Git in Visual Studio - add existing project?

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

I have setup a 'Team Foundation Service' Git account online.

I currently have an 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 Source
  1. First of all you need to install git software on your local development machine, e.g. Git Extensions.
  2. Then do git init in the solution folder. That is the proper way to create a repository folder
  3. Set up a reasonable .gitignore file, so you don't commit unnecessary stuff
  4. git add
  5. git commit
  6. Add the proper remote, as described in your Team Foundation Server account git remote add origin <proper url>
  7. git push your code

Alternatively, there are detailed guides here and here using the Visual Studio integration.