How do I enable Git for Visual Studio/Team Server 2013 - tfs

We have a Team Project we created in 2013. The web site of the project allows Git Repos to be created, but in Visual Studio 2017 the Git repos we created are always Offline and exhibiting other odd behaviors (loading TFVC's interface in Visual Studio even when connecting to a Git repo within it for example). I used Fiddler to check out the traffic and noticed that this particular project is missing the SourceControlGitEnabled = true flag. A project we created a year and a half later DOES include the SourceControlGitEnabled flag and works properly.
Is there a TFS Team Project setting we can alter/enable or do I have to create a new Project with Git as the repo and migrate everything to it?

When you create a new repo in the Team Project in TFS2013, there should be a warning as below:
Note that some versions of Visual Studio will only provide full Team
Explorer integration with a repository that has the same name as the
team project. Users may need to manually clone this new repository to
use it in Visual Studio.
This maybe the limitation of TFS2013 with GIT, either manually clone this new repository to use it in Visual Studio or create a new Project with Git as the repo and migrate everything to it, both should be work.

Related

How can I connect to on-premises TFS using Visual Studio Code?

How can I connect to on-premises TFS using Visual Studio Code? Is that possible the same way as in Visual Studio?
If you need to use Git, all you need is Visual Studio Code. Git is a built-in feature.
In order to also use TFVC you'll need to install an extension. You'll need Visual Studio Code and the Azure Repos Extension and a recent version of Team explorer and/or Team Explorer Command Line Client.
To edit Azure Pipelines (available in Azure DevOps Server 2019), you'll need to also install this Azure Pipelines extension.
The naming is a bit confusing, but these Azure DevOps extension also work with recent version of Team Foundation Server and Azure DevOps Server (new name).
First you need to install the official Azure DevOps Extension for Visual Studio Code which released by Microsoft.
It supports both TFVC and GIT version control type.
Clone your Git repository
With Git, the extension uses the remote origin of your repository to
determine how to connect to Team Services (or your Team Foundation
Server), in most cases you will need to have a Git repository already
cloned locally. If you intend on cloning an existing repository, do so
before proceeding. If you do not have a Git repository cloned locally
but already have a Team Services account (or a Team Foundation Server
instance), you may create a local repository (via git init) and once
you set the "origin" remote for that local repository, the extension
will detect the change to the remote and attempt to contact the Team
Services account (or Team Foundation Server).
Create your TFVC workspace
With TFVC, the extension uses information about the current workspace
to determine how to connect to Team Services (or your Team Foundation
Server). Workspaces can be created using the Visual Studio IDE,
Eclipse or with the JetBrains IDEs (e.g, Android Studio, IntelliJ).
Note: At this time, you will need to have a local TFVC workspace already available on your local machine. More information about the
difference between the two types (and how to determine which one
you're using) can be found here.
You could also take a look at below videos to help get you started using the extension quickly:
Set up the Team Services extension for Visual Studio Code - If
you haven't used the extension before, this video will show you how
to set it up, create a personal access token and get up and running.
Walkthrough of the Team Services extension for Visual Studio
Code - This is a walkthrough of most of the features of the Team
Services extension.
TFVC Source Code Control for Visual Studio Code - This video shows
you how to set up the TFVC support on Windows and demonstrates much
of the functionality available for Team Foundation Version Control.
Above is for Windows machine, if you are working on Mac, please take a look at this answer.
Note:
VS Code will leverage your machine's Git installation, so you need to install Git first before you get these features. Make sure you install at least version 2.0.0.
You need Team Foundation Server 2015 Update 2 or later.

How to clone a VSTS project/workspace locally?

We have a project/workspace setup in Visual Studio Team Services online. I would like to get a local backup of the workspace and project with all of its artifacts (attachments, Wiki notes and attachments, etc.).
Would a local version of TFS pointed to VSTS online clone the epics, features and stories locally? This is what I really need.
What is the process to accomplish this?
You can not clone the whole contents of a team project, but clone the source code from version control system (Git or TFVC) is possible.
If you are using Git as VCS, you can use below command to clone the VSTS git repo:
git clone <repo URL>
And you can also refer the document to clone a VSTS git repo via VS.
If you are using TFVC as VCS, you can map TFVC repo locally in VS. Detail steps you can refer Develop and share your code in TFVC using Visual Studio.
Seems you also want to migrate WIT from TFS to VSTS. You can refer these related posts: Migrate Workitems from local TFS into VSTS and Migrating Work Items from TFS 2017 to VSTS.
Besides, you can also refer the document Migrate data from TFS to VSTS.

How to enable git on existing TFS project?

Environment: Visual Studio 2017, TFS project set at visual studio online.
I am working on a community project. The source code is checked into TFS project using the free account provided by visual studio online.
I now need to enable git on this project such that others can use from other projects.
On TFS online, I see a way to create a new GIT-based project but I don't see any option to enable GIT on an existing TFS project. I remember to have used this option long time ago. Wondering where I can find this switch. Or, is there any easy way to migrate existing code to GIT. Regards.
You can use Import repository to import the Git repository from TFVC.
From the repo drop-down, select Import repository.
Select TFVC from the Source type dropdown
Type the path to the repository / branch / folder that you want to
import to the Git repository. For example,
$/0522TFVCScrum/BuildProcessTemplates
If you want to migrate history from the TFVC repository, click
Migrate history and select the number of days. You can migrate up to
180 days of history starting from the most recent changeset. A link
to the TFVC repository is added in the commit message of the 1st
changeset that is migrated to Git. This makes it easy to find older
history when needed.
Give a name to the new Git repository and click Import. Depending on
the size of the import, your Git repository would be ready in a few
minutes.
Refer to this article for details: Import repositories from TFVC to Git
Hover over the Code tab, click "Manage Repositories", then click the "New Repository" button.

remove git repository binding from visual studio 2015

Initially my project was mapped to a git repository.I Want to remove git mapping and bind it to tfs (vs2015).I removed .git folder and its related files from the solution(my local drive) and open the solution in vs2015 and change the source control option to tfs. when adding solution to the source control I'm getting the following error
"the current solution has projects that are located outside the solution folder.These projects will not be source controlled in git repository.To add all the projects to a single git repository please consider all projects under a single folder"
If I click on OK on this error dialog, it automatically adding git folder to the solution.
I removed source controler provider for GIT from the registry via regedit. Now when i try to add solution to the tfs I am getting the error "The project or solution you opened requires a source control plug-in that is unavailable at this time.
I've tried different ways nothing worked.
Create a new team project on the TFS web portal.
Start Visual Studio session. Select Tools->Options->Plug-in Selection and switch current source control plug-in to "Visual Studio Team Foundation Server".
From Visual Studio connect to the TFS and select the collection and the newly created team project. A local folder will be created for your new team project.
Copy all your sources in the local folder of the new team project.
Open the solution in the current session of Visual Studio. Add the solution node to the source control. Check in and your done.
You cannot change or mix TFVC with Git in the same project. You need to create a TFVC project, then check in the sources to the new project.
If you don't need to keep the source history, just pull down and check into the new version control as Mircea mentioned above.
If you want to keep the history, just try to migrate all history of main branch from local repo to a new TFVC team project with following steps:
Create an empty TFVC team project
Go to your local Repo folder, and use git-tf checkin --deep command
to checkin the local repo to a TFVC team project. By default, the
checkin command will create a single TFS changeset for the aggregate
of all changes made on the current branch in Git since the last
checkin to TFS. When used with the --deep option, a TFS changeset
will be created for each Git commit on the current branch since the
last checkin to TFS.

Using Xcode with TFS 2015 on-premises

Is there any way to check in code from Xcode to TFS 2015 on-premises installation? Even if TFS is just acting as a go between for Xcode and Git? The main thing we'd like to be able to do is for iOS code to be checked in to TFS with changesets recorded, and work items/bugs available.
Any suggestions? We are not looking to move to VS Team Services / VS Online.
you have 2 options.
The best option is to create a new TFS Team Project with Git for source control. Or you can add a Git repo so an existing Team Project. This is a standard Git repo, but hosted in TFS. It works just like any other hosted Git repo. Clone the repo and off you go.
If you cannot use Git inside TFS and you must use TFVC then you can use git-tf. This is effectively a bridge between a local git repo and a centralized TFS TFVC repo. This article should get you started
Both VSTS and TFS 2015 include full support for Git-based source control projects. You can follow MSDN article Share your code in Git using Xcode to push your project to TFS.
After pushing your project to TFS, you'll have full history and work item available:

Resources