简体   繁体   中英

How do I get my project out of Git and into TFS?

Last week I started a small project in Visual Studio 2017. Got it to the point where I want to check it into source control and share it with my co-workers. The problem is that somehow (man, I wish I knew how so that I could avoid doing this again) it got checked into Git on my machine. It isn't going to do anybody any good being checked into Git on my machine. And we've standardized on TFS. I've tried removing the .gitignore and .gitattributes files from the root folder of my VS 2017 project, but that didn't work. (Besides, the instant I got back into the project in VS 2017, those 2 files were recreated.)

So, how do I get the solution and project out of Git so that I can get it into TFS/TFVC?

The problem is that somehow [...] it got checked into Git on my machine.

That is probably the best thing that has happened to you! Follow the Microsoft example and standardise on git...

But, anyway,... Find the '.git' folder which is at the root directory (and that could be hidden), delete it and check your project in TFVC.

To get the solution out of git:

  1. In File Explorer open the folder where the solution is stored.
  2. Delete .git, .gitignore, .gitattributes files/folder

To add the solution to TFS/TFVC source control:

  1. Open project in VS 2017
  2. Open Team explorer and connect to a TFVC team project
  3. Right click solution > Add to source control

TFS supports Git too, so you could push it to a git repository in TFS:

  1. Create a new git repository in TFS
  2. Open VS 2017
  3. Open Team explorer
  4. Click manage connections
  5. Click Add in Local Git Repositories section
  6. Double click the added repository
  7. Click Home > Settings> Repository Settings
  8. Click Add in Remotes section
  9. Specify git repository (step 1) and name
  10. Click Home > Sync
  11. Click Push and select the repository (step 9)

I deleted all the .git files from the solution directory and still had issues...

Git kept defaulting to the source control even after restarting and setting source control to visual studio.

Fix: I then noticed that I wasn't signed into TFS!

After I signed into TFS in Team Explorer GIT stopped defaulting when I tried to add the solution to source control. I was able to add to TFS.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM