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!
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.
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.
The User Profile dialog will be displayed. Click to the Credentials tab to enable alternate credentials, then enter a secondary user name and password.
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.
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!
Ty saved me a lot of work!
Thanks for the article! I would like to point out that VSO is now pushing “personal access tokens” instead of the alternate access which means that the login used is slightly different. It looks something like:
https://PERSONAL_ACCESS_TOKEN@ACCOUNT.visualstudio.com/defaultcollection/_git/PROJECT
You can do secondary alternate credentials as well.
Also Adam, Thank you! You saved me a lot of hassle.
thanks a lot, i spent hours looking for a solution
Did you also succeed connecting with ssh?
I’m also really stuck on this. When attempting to use a repo I get the message ‘invalid packet’ – weird how this works fine from the CLI..
This might be relevant:
https://jira.atlassian.com/browse/SRCTREEWIN-6512?page=com.atlassian.streams.streams-jira-plugin%3Aactivity-stream-issue-tab
So how would I do this for a self-hosted TFS instance?