Visual Studio Online and SourceTree

I really like Visual Studio Online, and I tend to use it for my various pet projects. It’s free for up to 5 users, and you get issue/backlog tracking and source control all in one spot. Perfect for my needs!

A few months back, we made the switch from TFS to Git at work. The Git integration with Visual Studio 2012 has proven suspect, so I’ve taken to using SourceTree for all of my source control needs, and I really like it. So, when it came time to create my next team project, I decided to go stick with Git/SourceTree in Visual Studio Online. Setup was pretty easy but not entirely intuitive, and you know what that means. Yep, we’re gettin’ bloggy wit it. I’m going to walk you through the steps of creating a new Visual Studio Online team project and connecting to it with SourceTree.

Create a Visual Studio Online Account

In order to create a new project, you’ll need a Visual Studio Online account. It’s free to get one, and it links to your Microsoft Live account. Head on over to visualstudio.com and sign up!

create-new-account

You’ll be prompted for an account URL, which will be whateveryouwant.visualstudio.com. Remember this, you’ll need it later.

Create a Team Project

Now that you’ve got your account, the next step is to create a new team project. If you browse to your account URL (whateveryouwant.visualstudio.com), you should see a link to create a new project. Click that and a dialog pops up to collect details about the new project. Note that you’ll want to change the version control option to Git.

create-new-project

Enable Alternate Credentials

Here’s the trickiest part of the setup: you need to enable alternate credentials in order for SourceTree to access the repository. Go to your user profile by clicking your name in the upper-right corner, then click My Profile.

click-my-profile

The User Profile dialog will be displayed. Click to the Credentials tab to enable alternate credentials, then enter a secondary user name and password.

enable-alternate-creds

Make note of these values, too. They’ll also be needed when you configure SourceTree.

Configure SourceTree

Okay, Visual Studio Online’s all ready to go at this point, and now it’s time to put it all together! Download and install SourceTree, if you haven’t already. Open it up and click the Clone/New button. For the source path/URL, enter the following:

https://USERNAME:PASSWORD@ACCOUNT.visualstudio.com/defaultcollection/_git/PROJECT

Note that USERNAME and PASSWORD will be the secondary user name and password you created in your Visual Studio Online profile. ACCOUNT will be the value entered for your Account URL when creating your Visual Studio Online account, and PROJECT will be the name of the Visual Studio Online team project.

clone-new-repository

With the URL entered correctly, SourceTree should recognize it as a Git repository and display a message. Change the destination path if you’d like, then click the Clone button and you’re done!

Advertisements

10 thoughts on “Visual Studio Online and SourceTree”

Leave a comment

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s