This wiki is a walk-through of how to connect an existing BitBucket repository to Visual Studio Team Services.



Step 1: Create a build definition

In the project inside VSTS, navigate to the Build definitions and click the plus icon to create a new definition:

In this example, let's perform a Visual Studio build. You can see other options are available as shown below:

Next select Remote Git Repository.

Next, we need to setup the connection to BitBucket and visually VSTS is complaining to us:

Step 2: Connect the BitBucket Repository

In BitBucket, navigate to your code base and grab the URL of your repo.  You can construct this by taking the project URL (re., https://bitbucket.org/team/project) and appending the repo.  You can get the repo by taking a look at the generated command in the clone option:

In VSTS on the repository tab, click Manage to add a new connection to BitBucket:

Add a new external Git repository connection. This is where the URL determined above goes!

Hopefully, this saves someone some time!