Authenticating with Bitbucket not possible

Kris Janssen January 12, 2017

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 ...

EDIT

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.

 

27 answers

7 votes
bgannin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 29, 2018

Hi everybody,

I'd like to start by saying we hear your feedback and understand your frustration. We know how serious this is and apologize for the pain caused by these bugs.

We're a small but dedicated team in Atlassian doing our best to balance everyone's needs. When something like this happens we are keenly aware of how we failed you and know that we need to, and will, do better. Now let’s dig into some of the details and provide clarity around issues for this topic.

Several moving parts affect the authentication processes in Sourcetree for macOS:

    • OAuth tokens that have differing expirations and requirements per hosting service

    • Classic HTTPS username/password challenges

    • Two factor authentication

    • SSH keys (user managed or ST managed)


The following external changes also had an impact:

    • macOS revising how SSH keys are loaded and managed in 10.12 and 10.13 (details)

    • GitHub deprecating and disabling 'weaker' TLS encryption (details)


That complexity is our problem to solve though and you count on us to do it while delivering a rock solid experience, period.

To make tracking down issues less painful we've opened up our internal auth logging via the new Debug menu in 2.7.2. We are dedicated to improving this area, with fixes present in every release since we first started expanding the authentication options. Each sprint includes dedicated time to review and investigate any new authentication reports with test builds often privately shared with those affected.

Filing a ticket (https://jira.atlassian.com/browse/SRCTREE) is the single best way to help out. We review every ticket for how it impacts Sourctree, determine if it’s an existing or duplicate issue, and then follow up if we need more information or clarity.

Beta content, especially bug reporting, is not discussed or triaged on Community because this forum is for public releases - anything related to betas should be discussed on the "Trusted Testers" mailing list (https://groups.google.com/forum/#!forum/atlassian-sourcetree-beta) and/or tickets per the introductory message.

We genuinely want your help when these issues arise. Please vote or comment on an existing ticket; if there isn't one, open a new ticket with as much detail as you can provide. This will help us attack the right problems as fast as we can.

These are the primary tickets we're tracking for future updates:

    • SRCTREE-5368 missing uuid (fix deploying in 2.7.2 beta 4 today)

    • SRCTREE-4544 multiple prompts for SSH Keychain password

    • SRCTREE-5372 multiple password prompts with HTTPS


Thank you for your feedback, patience, and tickets - we strive to make our apps better every day.

Brian Ganninger
Senior Mac Developer, Sourcetree

Mike Rampanelli March 30, 2018

Thanks for your response. One note - 5372 either doesn't exist or the general public doesn't have permission to view it.

bgannin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 1, 2018

Good catch, fixed.

Josh Fialkoff October 15, 2018

@bgannin Sorry, wrong tag!

6 votes
bgannin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 11, 2017

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 OSX_Beta_Latest.zip 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

bgannin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 12, 2017

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

Deleted user May 24, 2017

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

bgannin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 29, 2017

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

ferile-bitbucket January 22, 2018

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!

Kris Janssen March 9, 2018

Almost a year after this and still things don’t work. Come on guys... get on it and address it properly.

Kris Janssen March 21, 2018

@bgannin How about an 'official' reaction?? This issue is still not fixed properly....

jtressle April 6, 2018

removed - wrong message :)

1 vote
stefanbauwens March 13, 2018

Changing my account protocol from HTTPS to SSH in Preferences > Accounts solved this problem for me. 

rob1702 March 21, 2018

Thanks for this, I was on SSH and changed it to HTTPS and managed to login. Then I changed it back to SSH and it works fine. 

Like Georg Dietrich likes this
1 vote
selenetw January 28, 2017

I am having the exact same issue.

os:macOS sierra 10.12.3

SourceTree 2.4

 

selenetw February 5, 2017

when i change the username , everything will be OK

keskinonur11Rename March 9, 2017

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 :) 

Juan Carlos Picado May 28, 2017

Me too.

1 vote
Jeff Coughlin January 28, 2017

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.

0 votes
Matt Gregg May 23, 2018

I'm on version 2.7.3 (169) and was trying to revert from OAuth to Basic auth and the dialog hides the password field so you can't even enter your password. I got around this by tabbing from the username field to the hidden password field and pasting my password.

Manju
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 24, 2018

Is this on Basic auth + ssh configuration for account?

0 votes
Mark Beaty March 8, 2018

Ugh. This is freaking annoying. I'm going to have to abandon SourceTree.

Mark Beaty March 8, 2018

Latest version as of today. Can't sign in to my bitbucket repos

Mike Rampanelli March 8, 2018

I'm evaluating Git Tower and so far it's pretty good. It's not free though.

Mark Beaty March 8, 2018

This is maddening. It was working without any changes to SourceTree or my bitbucket account. And then it just stopped working. I can't push or pull via SourceTree. Sure, I can use the command line, but I like the UI. I'm not sure Atlassian cares if people abandon SourceTree because this problem continually pops up just out of the blue, people complain, and nothing gets done other than to tell people to jump through hoops to fix a problem they can't seem to figure out. 

Mark Beaty March 8, 2018

You said above that downgrading to 2.6.3 fixed it for you. Well, I was on 2.6.3 when it started happening. So, I removed it completely from my system and installed the most current version (2.7.1) and have the same problem. Maybe only downgrades from the version you are using fixes it. LOL. 

Mike Rampanelli March 8, 2018

Come to think of it, I think I was on 2.6.3 when I started having problems. So I did the same thing, completely removed it from my computer, installed the latest, and the problem was still there. Then I downgraded to 2.6.3 and it started working again. My problems started the day that they had the outage. I was thinking that maybe that played a part in it. Not sure if it matters but I'm on a Mac.

Manojkumar_Murugesan April 19, 2018

I still have the same issue with 2.7.3, OAuth / SSH never works. Only Basic HTTPS works but it always asks me for password every single time even if the store password option is still selected.

But SSH mode works nicely with Github account, not sure why doesn't work well with Bitbucket when source tree is one of their product 😕

Manju
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 24, 2018

Please provide details on the errors you see and the account configuration to help you in this regards. 

Manojkumar_Murugesan May 24, 2018

I followed the instructions from here, still it fails and keeps asking me to login using SSO and even after it fails. My username is `manojdcoder`

But with Github, I followed the same and it worked like charm. 

Manju
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 24, 2018

Can you make sure your repository's remote URL is also SSH? It could complain if its not. You can right click on the repo listed in the repo browser and convert it to SSH if needed. 

As as second step, I would recommend you to remove the account and add it again to make sure the right credentials are stored in keychain and it doesn't use a stale one. 
Along with that, please check if the ssh-agent has your keys loaded. If not, please add them to the agent. 

Run below commands in terminal to do so,

To check if keys are loaded:

ssh-add -l

To add keys to agent:

ssh-add <path_to_key>

more like,

ssh-add ~/.ssh/id_rsa

Key in the passphrase used while generating the ssh key and you should be good to go.

Manojkumar_Murugesan May 24, 2018

I'm not sure which repo URL I used, will try once again to with SSH and update here.

But at least I expected it to list all my repos, but it always thrown me errors. I'm sure the keys stored were right ones. 

Manju
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 24, 2018

Gotcha! You should remove the account and add it back to see the repos listed. Please revert back if you end up seeing errors. 

Manojkumar_Murugesan May 25, 2018

It's always the same errors. Besides even if I use basic username / password authentication, it still asks me password every time no matter how many times I check the option to save in keychain.

I'm really wondering why an Atlassian's product should work really well with Github but why not with it's own Bitbucket. If you think I'm missing something, kindly share a step by step video / image tutorial for Mac with latest SourceTree. I have followed this guide 100 times already, so kindly do not paste the same.

Manju
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 25, 2018

Can you add some screenshots of the account setup and paste the output of below command?

ssh-add -l
Manojkumar_Murugesan May 25, 2018

It simply says "The agent has no identities."  Still Github account worked, the steps followed were exactly same.

Sadly I moved to GitKraken app after being with SourceTree for at least 4+ years. I liked SourceTree, it used to be simple, easy and clean. With GitKraken the steps to add Bitbucket SSH was exactly same and it worked on first try. 

I will definitely be happy to get back to SourceTree once I know these hurdles are resolved. Thank you for your support.

Manju
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 25, 2018

That explains it. As I mentioned earlier above, the ssh agent on your Mac doesn't have the key loaded. You need to load the key manually by running below command. Without which, I believe you wouldn't be able to use it even with command line.

ssh-add <path_to_key>

The reason why this happens is because of the changes Apple made with OpenSSH on the macOS. You can read more about it here

Alternately, you can switch to using https with OAuth if you feel ssh is a hurdle. 

We are working to resolve this problem for our users in a grateful way. But, that would take some time given the team size of Sourcetree and all the things that take a slightly higher priority.
Should you need help getting the setup right, please feel free to reach out to me and I can Skype to help you with that. We would be glad to have you back to using Sourcetree. 

Thanks!

Manojkumar_Murugesan May 25, 2018
  1. OAuth + HTTPS didn't work either which is why I moved to SSH in first place. No matter how many times I log in with OAuth, it used to ask me for signin again and again.
  2. If you say it's problem with SSH changes in mac os, I would like to understand how it worked only for Github account without adding the keys manually from command line.
  3. Now I have configured GitKraken with both Bitbucket and Github accounts, still the command returns same response "The agent has no identities." and nothing stops me from cloning, pushing etc.,
Manju
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 25, 2018

1. I am not sure why this didn't work for you. But, we know of some issues in 2.7.3 which we have fixed in 2.7.4. Feel free to try it out by downloading the new build here - https://bitbucket.org/atlassianlabs/sourcetree-betas/downloads/OSX_Latest.zip. Again, I recommend you remove your account and add it again. You can enable debug logs and send me when you do that. Navigate to Preference window -> Advanced tab and enable "Show Debug Menu" checkbox. From the new menu that gets displayed at the end of the main menu, Enable Auth Logging and Select Debug under Log Level. There are options to locate the log folder.

2. Please provide a screenshot of your account config in Sourcetree and a screenshot of the repo you've cloned ( I need to confirm the protocol used in the repo). 

3. Sourcetree uses either embedded git binary or your system git to run everything for you. We try to keep things as native as possible. If you can work with command line and your ssh works, it works with Sourcetree. On the other hand, other applications use various libraries, third party dependancies to run git and support git. You may want to check if there are multiple ssh agents running on your machine.

Terminal should be the best place to confirm the ssh setup for git and Sourcetree. 

0 votes
bosenj March 1, 2018

The issue is still there, i'm having the same problem. 
I feel frustrated. my sourcetree version is 2.7.1.

Mike Rampanelli March 6, 2018

Thanks, that worked for me too. I'm done upgrading Sourctree. Too many times I've been burned by bad updates. If it works, don't upgrade.

0 votes
mywebdrag February 9, 2018

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

will martin February 9, 2018

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.

jtressle February 9, 2018

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

Mike Rampanelli March 6, 2018

Thanks, downgrading to 2.6.3 worked for me too. I'm done upgrading Sourctree. Too many times I've been burned by bad updates. If it works, don't upgrade.

0 votes
jtressle January 22, 2018

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. (com.google.HTTPStatus error 401.)"

Manju
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 23, 2018

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

Kris Janssen January 23, 2018

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

ferile-bitbucket January 23, 2018

That is my issue as well. Same thing

Navid Dena January 25, 2018

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

Andrew Yan February 12, 2018

Same here. SourceTree 2.7

Nick Maddren February 19, 2018

Exactly the same problem, it's very frustrating.

0 votes
Kris Janssen May 11, 2017

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

2017-05-26

Actual version no is 2.5.2, build 111

Knock on wood...

 

 

haranathg December 21, 2017

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!

Manju
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 28, 2017

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. 

Thanks,
Manjunath

Sonia January 18, 2018

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.

Manju
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 18, 2018

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?

Sonia January 18, 2018

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!

0 votes
Alvin Cris Uy May 10, 2017

Any body solved this issue without changing usernames?

Chillifish May 11, 2017

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

Juan Carlos Picado May 28, 2017

Yes, it worked out.

Kris Janssen May 29, 2017

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)

Juan Carlos Picado May 29, 2017

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

Kris Janssen May 29, 2017

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

0 votes
Mike Gorodilin April 27, 2017

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

0 votes
Mark Woodward April 18, 2017

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.

ferile-bitbucket January 23, 2018

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. 

0 votes
alpex92 March 17, 2017

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

0 votes
Jan Dockx March 17, 2017

me23

0 votes
miroslavbucek March 14, 2017

Same issue.

0 votes
Dawid Sowa March 13, 2017

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

0 votes
keskinonur11Rename March 9, 2017

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 :) 

0 votes
paullewisn March 7, 2017

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. (com.google.HTTPStatus 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.

paullewisn March 13, 2017

This is with BitBucket. GitHub works perfectly for me!  

keskinonur11Rename March 13, 2017

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.

0 votes
Jack White March 6, 2017

I'm also experiencing this issue.

0 votes
Siddharth Sudheer March 1, 2017

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

0 votes
dawidof February 23, 2017

Same issue, couldn't authenticate to github.

0 votes
rushko February 19, 2017

Same here, no solution yet?

0 votes
Chillifish February 10, 2017

Same here.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events