11

I've enabled two factor authentication for my bitbucket account. Now Atlassian Sourcetree app on Osx doesn't works, it is unable to login on bitbucket.

How i can configure SourceTree to use bitbucket two factor auth?

Premier
  • 3,952
  • 6
  • 39
  • 56

5 Answers5

9

Skip the initial login and from bitbucket.org, click the down arrow next to the repo name (to the left of the ssh/https link) and click 'clone to source tree' and it will work fine assuming you have your ssh keys setup already.

This worked fine for me when I just installed it and ran into the same issue of not allowing me to login initially.

-- update June 2016 --

Bitbucket now allows you to add an app password for specific apps like source tree. It is found under bitbucket settings > access management > app passwords. Once I created one and added the password to my source tree settings then I was able to successfully connect and reconnect to bitbucket to push and pull updates and create new repos.

jamescampbell
  • 9,349
  • 4
  • 30
  • 41
3

Madness. Sourcetree supports Github MFA, but not BitBucket :(

We are working on adding application specific passwords to resolve most of these issues. You can track this addition in the issue 11774 application-specific-passwords-or-tokens.


SourceTree will use SSH to do most everything with Bitbucket except build a list of repositories.

Workaround: Manually add each new repository until app passwords are available.

Status on resolving this issue: SCHEDULED

bitbucket/two-step-verification-777023203.html#Two-stepverification-ConfirmapplicationsuseSSH


In practice, this means creating the repo on the bitbucket website, then clicking 'I have an existing project' and copy pasting the revealed git commands into the terminal, like:

cd /path/to/my/repo
git remote add origin git@bitbucket.org:username/repo.git
git push -u origin --all # pushes up the repo and its refs for the first time
git push -u origin --tags # pushes up any tags

Then (after a refresh) Sourcetree will display your new remote.

ptim
  • 12,355
  • 8
  • 70
  • 89
2

There's a known bug around SourceTree and 2FA: https://confluence.atlassian.com/bitbucket/two-step-verification-777023203.html#Two-stepverification-Troubleshootingtwo-stepverification

Jim Redmond
  • 2,833
  • 1
  • 9
  • 17
  • 2
    The Link is no longer valid, so the accepted answer is meaningless as of now. Please write the solution, too the next time. – Arda Apr 18 '16 at 18:49
  • 2
    This link is outdated and should no longer be the right answer as accepted @Premier – jamescampbell Jun 23 '16 at 15:42
1

For future reference, the ones who have configured their accounts to use OAuth and ssh to log in, but still run into the "There was an error authenticating the request. The account is configured to use Basic Auth with HTTPS but may have 2FA enabled on the server. Please edit your account to use OAuth."

Go to the main view of Sourcetree (I.E. where you add repositories). Right click your repository and select "Convert to OAuth".

Hammarang
  • 11
  • 4
0

SourceTree for Windows 1.10.x and SourceTree for Mac 2.4.x both now support using OAuth over HTTPS for REST api interactions and Git/Hg calls.

In both cases this means its possible to turn 2FA on Bitbucket but continue to use HTTPS rather than SSH for the Git/Hg remote urls.

mminns
  • 41
  • 1
  • 2
  • 10