Authenticating with Bitbucket not possible

I recently tried to set up my dev environment on a new macbook.

  • Sourcetree 2.4 (90)
  • maxOS Sierra 10.12.3 Beta (16D25a)

I first tried to authenticate using HTTPS with Bitbucket but even after verifying/resetting my password multiple times, I can just not login, I just get a very random error message:

Could not authorize request with the available token. Please re-authenticate.

To login, I have tried adding my Bitbucket account through 'preferences/accounts'

Screenshot 2017-01-12 15.15.15.png

After supplying my credentials it sometimes briefly loads my avatar correctly, like it does for GitHub but upon loading repository browser, it instantly unloads the avatar and throws the error above:

Screenshot 2017-01-12 15.19.32.png

This is getting very annoying, very quickly... 

Moreover, even though I have correctly generated an SSH key pair and added the public keys to my GitHub and Bitbucket accounts, the Sourcetree account UI refuses to 'see' or let me add my keys... it insists on generating new ones. Why is that?

Screenshot 2017-01-12 15.22.45.png

Screenshot 2017-01-12 15.22.54.png

Like this, Sourcetree is effectively useless ...


The above issue presents itself when trying HTTPS authentication in combination with OAuth. If instead 'basic' authentication is chosen, repo browser seems to load remotes correctly. However, occasionally I still seem to get logged out.


22 answers

1 accepted

Hi all,

The addition of OAuth was a fundamental architecture change for SourceTree on macOS and unfortunately there have been a number issues centered around how tokens are stored and accessed in the keychain that we've spent a lot of time investigating for the next update (2.5.2). That release is available here as currently with a refresh coming tomorrow (you can sign up for the trusted_testers mailing list to be notified of updates.) Full details: 2.5.2 Release Notes

We greatly appreciate our community's patience as we deal with these growing pains and varying implementation details such as hourly token timeouts or newly introduced rate limiting. Once 2.5.2 is generally available if you're still encountering problems we'd ask that you reach out either via a ticket on JIRA or Atlassian Support, depending on your preferences. Rest assured, we're reading your feedback in all channels and striving to make the product better with each release.

Brian Ganninger
Senior Mac Developer, SourceTree

The new build, 2.5.2 (109), is now available as a beta.

Brian, I've tried the beta version (2.5.2), still doesn't work.

Please file a ticket on JIRA (see previous posts) and we'll follow up on debugging details. Thanks for your patience.

So the issue really does seem to be that if you have the same username on your github and bitbucket accounts, you cannot authorise with bitbucket on a macintosh device. I had this issue until i changed by usernames on both accounts, and I seem to be able to pull down code now. 

My desktop PC and Sourcetree works fine, no issues. Really bizarre problem that Atlassian really needs to look into!

I am having a similar issue, but for me it's with github.  I was having a similar issue connecting to bitbucket, but was able to get around it by allowing SourceTree to create a new key.

I am having the exact same issue.

os:macOS sierra 10.12.3

SourceTree 2.4


when i change the username , everything will be OK

I tried as you said, before i had the same usernames for my Github and Bitbucket accounts. Then i changed the username of my Bitbucket account and everything works now :) 

I am having the exact same issue.

Same issue here. It doesn't work for Github OAuth, but Bitbucket is fine.

Same here, no solution yet?

Same issue, couldn't authenticate to github.

same here! I hope there's a fix soon!

I'm also experiencing this issue.

Identical issue here too.

If I am oauth/SSH I get:

Could not authorize request with the available token. Please re-authenticate.

If I am to basic/SSH I get:

The operation couldn’t be completed. ( error 401.)

If I am oauth/HTTPS I get:

Could not authorize request with the available token. Please re-authenticate.

If I am basic/HTTPS I get signed in, but I have to re-enter my password twice on each pull or push, despite the 'store in keychain' option being set.

Very close to giving up.

This is with BitBucket. GitHub works perfectly for me!  

is your Bitbucket and github account names equal? if so change your Bitbucket account name (just add 2-3 more characters at the end) and retry. i solved my problem just like this.

I tried as you said, before i had the same usernames for my Github and Bitbucket accounts. Then i changed the username of my Bitbucket account and everything works now :) 

It's been two months and I still can't connect sad

Same issue here. Fix this please!!! SourceTree 2.4.1 MacOS sierra.

Same issue started happening suddenly for no apparent reason.

"Could not authorize request with the available token. Please re-authenticate."

And am CONSTANTLY receiving prompts to enter BitBucket password, even when there are several prompts already displayed.

SourceTree v2.5 (104)
MacOS v10.12.4 (16E195)

Issue persists after performing the following:

  • Have removed all accounts from SourceTree
  • Removed all ssh keys
  • Removed SourceTree's generated .ssh/config
  • Removed all BitBucket/Atlassian passwords from KeyChain
  • Added my BitBucket account to SourceTree again (OAuth)
  • Generated new ssh key

My BitBucket and GitHub usernames are the same, but I'm not even trying to add GitHub at the moment.

That's what happens on mine as well. 

It seems related to High Sierra Mac OsX, and the current version of Sourcetree as of January 2018.

I fixed mine by changing my username on Bitbucket, but I still get intermittent issues around auth and saving my password to keychain. 

Same issue. It's getting extremely annoying...

Any body solved this issue without changing usernames?

No. Can't understand why there's been no response either.

You might havre mentioned that you need to download an early build for things to work.

The officially available 2.5.2 (105) still has issues.

The build that actually fixes things is 2.5.2 (111)

I still have 2.5.2 (105), but it's good to know 2.5.2 (111) fix the issue.

Well in 105, the issue definitely was not resolved. But anyway...

One of the latest builds for macOS seems to resolve the matter finally:


Actual version no is 2.5.2, build 111

Knock on wood...



Hi, I've tried 2.5.3c and 2.6.3a on MacOS 10.11.6 (El Capitan) - and both I'm having issues connecting to bitbucket.  Same errors reported by this user both for the oAuth as well as basic authentication.  I'm able to connect using the preferences/accounts - but when I tried to refresh the repo I get the errors.

Appreciate any help!

Hi, Can you please make sure the protocol for the account and your repo clone/remote URL are same?

If account is ssh, remote  URL should also be ssh and likewise with https. 

I would recommend using the latest version 2.7 (142) for your work. 


I am having the same issue... I cannot login to Bitbucket in Sourcetree to update my remote repositories. I am using 2.7 on MacOS High Sierra. I checked that the protocol is the same. I tried with OAuth and with the Basic Auth Type. Nothing seems to work. I can login just fine on BitBucket Cloud though, and double checked my username and password. Nothing works... Any help is appreciated.

Can you describe what is happening when you try to login and include any error messages, screenshots that might help us help you with this?

I was getting the same errors as Paul (post on Mar 07,2017). However, I just managed to fix it by changing my username on Bitbucket, by adding a few more characters to it, and then updating it in SourceTree. I found this suggestion in one of the replies above. Thanks!

I have the same exact issue.  

Has this been fixed yet?

I've reinstalled Sourcetree, cleared all caches, keychain credentials and am still unable to access my remote gits.

My error is " The operation couldn’t be completed. ( error 401.)"

Can you confirm the version of Sourcetree you have installed now?

This happens even with the most up to date versions of Sourcetree (It auto updates rather frequently): currently 2.7 (152)

That is my issue as well. Same thing

Same issue.  Just got my new mac book pro, installed latest version of source tree 2.7 (152), and no dice.

Same here. SourceTree 2.7

0 votes
jason I'm New Here Feb 09, 2018

Hi All, has anyone solve this issue? i'm having the same problem. 

As a workaround, when I was awaiting notification from our security team that my access was granted ...

I logged in to SourceTree with my google account.

Then I logged into my repo from within Sourcetree, and no issues.

I *was* having issues with direct bitbucket repo creds against sourcetree.

Since the initial success with my gmail to get into SourceTree, I am using my internal account as desired for all logins.

hope this helps.

My workaround was to downgrade SourceTree.  I went back to version 2.6.3 (build 134) and the problem went away.

Suggest an answer

Log in or Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

638 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot