Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 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?

like image 399
niico Avatar asked May 29 '13 22:05

niico


People also ask

How do I import a Git project into Visual Studio code?

Open the command palette with the key combination of Ctrl + Shift + P . At the command palette prompt, enter gitcl , select the Git: Clone command, and press Enter. When prompted for the Repository URL, select clone from GitHub, then press Enter.


2 Answers

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).

like image 188
airbear Avatar answered Sep 17 '22 12:09

airbear


  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 using the Visual Studio integration.

like image 43
Klas Mellbourn Avatar answered Sep 20 '22 12:09

Klas Mellbourn