Connecting Atlassian SourceTree With Your Azure DevOps GIT Repo
Tags: git, howto, devops, microsoft
Published: 2020-01-31 07:58:15

---
title: Connecting Atlassian SourceTree With Your Azure DevOps GIT Repo
published: true
description: 
tags: git, howto, devops, microsoft
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/pcb163ha21i18fj3iw1t.png
canonical_url: https://medium.com/@EeKayOnline/connecting-atlassian-sourcetree-with-your-azure-devops-git-repo-b88aeab91b00
---


In this short post, I will show you how you can setup Atlassian SourceTree so it will connect with Microsoft Azure DevOps project’s GIT repo.

I like using SourceTree in my development teams since it is an easy interface, is available for both Windows and Mac OS, and it supports the [Gitflow Workflow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow), which is especially great for release-based projects.

### Background

[Back in 2018](https://azure.microsoft.com/en-us/blog/introducing-azure-devops/), Microsoft renamed VisualStudio Online into Azure DevOps. It sounds more catchy and it indicates its purpose more; enabling developer teams to take care of rolling out their software independently.

But changing a name for an online service also means changing the URL. And this is where a lot of people are getting mixed up on what to use for their GIT repo URL.

Add in a snuff of confusion by changing the access for external tools from username password to a Personal Access Token (PAT) and you have a lot of people getting confused.

Because is more annoying than if you can’t get your favorite GIT client to work with a GIT repo that you want to clone.

I got this working via the following steps:

1. Create a PAT in Azure DevOps ([https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops](https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops))

1. Make sure you copy the **generated PAT** as you won’t be able to view it again

1. On Source Tree, go to add account and select Azure DevOps

1. for the host, I used [https://{organisation}.visualstudio.com](https://{organisation}.visualstudio.com) as the new URL format for azure DevOps didn’t work

1. **enter the generated PAT as username**

1. **use the PAT you just generated for the password as well**

After this, you can get the URL of your repository and add your repo to Sourcetree as described [on the SourceTree help page](https://confluence.atlassian.com/sourcetreekb/add-an-existing-repository-into-sourcetree-780870053.html).

### Do the credentials appear to be ignored?

If somehow your Sourcetree doesn’t seem to be using the right PAT credentials when you try to clone your repo, force Sourcetree to use the credentials by prefixing the URL with them:

    *https://{token}:{token}@{organisation}.visualstudio.com/{projectname}/_git/{projectname}*

Using these steps, SourceTree will force using the PAT as credentials for the repo and you can clone and work on the repo directly.

*Somehow, I couldn’t get the username — PAT as a password combination working. I found out this route and it works for me.*

### Please note

At the time of writing, there are some things you should know. I didn’t use them in my instructions to spare them for you and because you probably — like me — just want to get to speed and work with your repo:

* The old “visualstudio” URL still needs to be / can be used for closing 
([**read more here](https://community.atlassian.com/t5/Sourcetree-questions/Re-Azure-DevOps-with-Sourcetree-Adding-a-remote-account/qaq-p/1065031/comment-id/29097#M29097)**): [https://*username*.visualstudio.com](https://*username*.visualstudio.com)

* Apparently, you can use the new URL alongside with your PAT, but you need a *hacky* way to do it ([**read more here](https://community.atlassian.com/t5/Sourcetree-questions/Re-Azure-DevOps-with-Sourcetree-Adding-a-remote-account/qaq-p/1214972/comment-id/33384#M33384)**)

### Concluding

Hopefully, this post helped you save some time while you set up the really nice SourceTree interface alongside the Azure DevOps environment.

Once you’ve gotten them to play nice together, they supplement each other:

* SourceTree can be used by both Mac and Windows users on your team and makes your team talk in the same *GIT lingo *and use *Git WorkFlow*.

* Whereas Azure DevOps lets you work on your product in an Agile manner, with planning boards, automated flows via Pipelines, and GIT repos.

Code Hard, Ship harder 🔥