12
votes

I've created a new project on azure devops and now I'm trying to add an account to sourcetree:

I've setup the opions in the following way:

Host: Azure devops

Link next to Host: https://[email protected]/myuser
Also tried with https://dev.azure.com/myuser

Auth Type: It's locked to private token, can't change it.

Username: Tried with my email, also enabled alternative credentials and tried with that username.

Password: Tried with the real password as well as the personal access token

Protocol: HTTPS

I keep getting the error: We couldn't connect to Azure DevOps with your credentials. What could be the cause of this?

4
Issue tracker for this issue - go vote it up and it's more likely to get fixed jira.atlassian.com/browse/SRCTREEWIN-10800Mark Silver

4 Answers

15
votes

Although SourceTree for macOS has updated the name of Azure DevOps (from "Visual Studio Team Services"), it appears that it does not support the new Azure DevOps URLs.

You can use the old-format (VSTS-style) URLs. Instead of https://dev.azure.com/username, you can use https://username.visualstudio.com.

SourceTree

Ironically, it seems that SourceTree for Windows still calls the product "Visual Studio Team Services" but supports the new-style Azure DevOps URLs.)

2
votes

You need to set up a Personal Access Token.

The below is from the documentation

Personal access tokens (PATs) are alternate passwords that you can use to authenticate in to Azure DevOps and Team Foundation Server (TFS). In this article, we walk you through how to create or revoke PATS.

Azure DevOps Services and TFS use enterprise-grade authentication to help protect and secure your data. Clients like Visual Studio and Eclipse (with the Team Explorer Everywhere plug-in) also support Microsoft account and Azure AD authentication.

For non-Microsoft tools that integrate into Azure DevOps but don't support Microsoft account or Azure AD authentication, you must use PATs. Examples include Git, NuGet, or Xcode. To set up PATs for non-Microsoft tools, use Git credential managers or create them manually.

0
votes

Basically, you need to:

  1. generate the PAT
  2. In Sourcetree, add a new account with the PAT as username AND as password
  3. If Sourcetree seems to be making you struggle (caching or not picking the right account if you have multiple) just add :yourorgname.visualstudio.com/projectname

PS: I wrote a post on this (this one), check it out if you want the full details.

0
votes

After surfing entire internet I found the answer.

Refer this link and at Point 4., remember to add expiration date. By default it selects existing date, you need to select expiration date. It was this place where I did not select expiration date and it keeps throwing login error message.

I selected 1year from today as expiration date, Full Access under Scopes.

Your clone > HTTPS Link wont work. Like this URL

Follow @Edward Thomson format to input URL

Username: Your generated Token

Password: Your generated Token (same as Username)

OR

Username: Your email to Azure DevOps

Password: Your generated Token

@taigi100 You can delete token by selecting revoke on Azure DevOps

@taigi100 @Murray Foxcroft - Hope this helps.