How-To: Set up VS Code with Git and TFS Server

I am consistently impressed with Visual Studio Code. It’s light weight, it’s open source, it’s on OS X, Windows, and Linux, and it’s free. Whether the use case is having people on different platforms, and different hardware configurations, having the same experience, or simply avoiding the need to spin up a full IDE, VS Code gets things done. And it even supports Git out of the box! What’s not to like?

There is a minor quibble, though. If you’re running TFS locally, support isn’t there. It supports Visual Studio Team Services (the online version, formerly known as Visual Studio Online), but not the local version. Good thing there’s a simple fix.

Install Visual Studio Code

So, first things first, download and install Visual Studio Code. It’s an incredibly straight forward process, though I do want to point out one thing:

image

You may want to opt in on having the ‘Open with Code’ shortcut added to your context (right-click) menu in file explorer. This is a really useful way to open entire folders in code quickly.

So, you may be asking, what is the secret sauce for getting VS Code to work with a local TFS?

Install Git Credential Manager for Windows

Git Credential Manager for Windows (download) is also open source (don’t you love open source?) and is a great way to handle git on your system.

Go through the install, picking your preferred settings, and watch for this one:

image

Git Credential Manager will be very useful.

Set up your git connection

Okay, so the easy stuff is out of the way, now for the other easy stuff.

Open up Git GUI (it installed with Git Credential Manager for Windows), and select Clone Existing Repository.

image

For source location, you’ll need the IP address/URL for your TFS server, as well as the path to the project. This happens to be the address when you’re looking at the Code tab in the TFS dashboard.

The target directory is where you want to host the files on your local machine. The result should look something like this:

image

At this point, you’ll be prompted for your TFS login credentials (watch out for the domain!).

After it’s all set up, navigate to the project, right-click on on the root folder and open in VS Code (you did set up the context options earlier, right?).

And with that, you have git access to your local TFS server. Now, all you need to do is figure out how to use VS Code’s built in git functions.

This entry was posted in How To and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s