Sourcetree login issues SDNetDomain error 7
Asked by Robert Medina:

Sourcetree cannot login to personal Bitbucket Server. I get the following error:

----------------------------------

Login failed for your Bitbucket Server account.

The remote service said: 'The operation couldn't be completed. (SDNetDomain error 7.)

----------------------------------

Software:

OS: Mac Sierra

BitBucket Server 5.7

SourceTree 2.7.1

Methods I have tried:

I have verified that I can login to the BitBucket Server using my username and password.

I have verified that I can make commits to BitBucket Server using the terminal.

During account creation under SourceTree I have used both protocols HTTPS and SSH.

I disabled SSL verification under the Git tab.

I did change the password to my account and I was able to make the error disappear but it reappear after the second login attempt.

Does anyone know how to solve this error or squelch this error message? If anyone can comment, please do thanks!


Answers:
author: Ana Retamal
body: Hi Robert! Do you have two-step verification enabled? This might be causing the issue. You can try to fix this by creating a Personal access token as explained at [Personal access tokens](https://confluence.atlassian.com/bitbucketserver/personal-access-tokens-939515499.html?_ga=2.36297248.1659460749.1520844590-764984710.1492455458). After that, open Sourcetree, go to Settings, remove the account listed and add your account again.

Please confirm that you added your account following the steps at. [Connect your Bitbucket account](https://confluence.atlassian.com/get-started-with-sourcetree/connect-your-bitbucket-or-github-account-847359096.html)

There are some other users sharing their solutions in [this Community thread](https://community.atlassian.com/t5/Sourcetree-questions/Can-t-register-in-sourcetree-mac-app/qaq-p/445130), you might want to give it a try too.

Let us know if it helps!

Ana

comments: author: Robert Medina
body: Thank you for the help Ana, I appreciate it very much. I have tried the suggestions above and none seems to resolve the error.

Bitbucket Server seems to not offer [two-step verification](https://jira.atlassian.com/browse/BSERV-7815), so I do not believe this could be the issue.

I remade a new account in Sourcetree and added the personal token access as a password but the error persisted.

I did create an account on Bitbucket Cloud and the error did not appear so this seems to be a Bitbucket Server issue only. In my Bitbucket Server instance I enabled debug logging to make sure any issues would appear in the "atlassian-bitbucket.log" log file. There is nothing being reported in this log.

I will continue to resolve this issue and update the community on anything useful I find!


author: Manju
body: Can you please enable debug logging by running below command in terminal and send us some logs the next time you add the account?

    defaults write com.TorusKnot.SourceTreeNotMAS "LogLevel" 5

Please send both console logs and Sourcetree specific logs from \~/Library/Logs/Sourcetree

Few things to note while adding the account

1. Remove the existing account from preference window.

2. Make sure the corresponding keychain item is also removed.

3. Add the account with https protocol and basic auth (OAuth isn't supported as of now and is also disabled).

4. Make sure the URL is valid and includes any port number if required.

5. Verify that Sourcetree wrote to keychain for the new account.

Should you see the error again, please revert with logs.

Thanks,  
Manjunath  
Sourcetree Mac Developer


author: Robert Medina
body: I ran the command and followed the steps involved and this is what the log file printed out:

2018-03-16 17:37:20 +0000 () \[AUTH\] signing out of Bitbucket Server account  
2018-03-16 17:37:20 +0000 () \[AUTH\] Removing the token available in the client before re-authentication

I verified that the keychain for the account was added after I created the new account and tried logging in.

![Screen Shot 2018-03-16 at 1.52.18 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/17315i283F9B89727BF1A4/image-size/large?v=v2&px=999 "Screen Shot 2018-03-16 at 1.52.18 PM.png")

On SourceTree the error remains unchanged.

![Screen Shot 2018-03-16 at 1.50.40 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/17314i601E427FA790DB38/image-size/large?v=v2&px=999 "Screen Shot 2018-03-16 at 1.50.40 PM.png")

Note:

I also reran the command with the new value "5" and it gave me more of the same:

2018-03-16 17:37:20 +0000 () \[AUTH\] signing out of Bitbucket Server account  
2018-03-16 17:37:20 +0000 () \[AUTH\] Removing the token available in the client before re-authentication  
2018-03-16 17:41:09 +0000 () \[AUTH\] signing out of Bitbucket Server account  
2018-03-16 17:41:09 +0000 () \[AUTH\] Removing the token available in the client before re-authentication  
2018-03-16 17:45:58 +0000 () \[AUTH\] signing out of Bitbucket Server account  
2018-03-16 17:45:58 +0000 () \[AUTH\] Removing the token available in the client before re-authentication


author: Robert Medina
body: Update:

I have been running these two versions for about 10 days and they both have been running well until yesterday. The error reproduce itself when I tried to clone a repository from my Bitbucket Server. I re-ran SourceTree and enabled logging using this command:

    defaults write com.TorusKnot.SourceTreeNotMAS "LogLevel" 5

Here is what the log file printed out:

```
2018-03-26 19:58:03 +0000 (e) JSON parsing error - The data couldn?t be read because it isn?t in the correct format.
2018-03-26 19:58:13 +0000 (e) JSON parsing error - The data couldn?t be read because it isn?t in the correct format.
2018-03-26 19:58:44 +0000 (e) JSON parsing error - The data couldn?t be read because it isn?t in the correct format.
2018-03-26 20:04:35 +0000 () [AUTH] signing out of Bitbucket Server account
2018-03-26 20:04:35 +0000 () [AUTH] Removing the token available in the client before re-authentication
2018-03-26 20:19:10 +0000 () [AUTH] signing out of Bitbucket Server account
2018-03-26 20:19:10 +0000 () [AUTH] Removing the token available in the client before re-authentication
```

Any ideas on how to proceed with this, thanks!

[@Manju](/t5/user/viewprofilepage/user-id/222564)[@Ana Retamal](/t5/user/viewprofilepage/user-id/1067288)


author: Robert Medina
body: I solved my issue regarding Bitbucket Server 5.7 and Sourcetree 2.7.1. I ran a new installation since our company has been updating the Bitbucket Server from 4.11. I thought maybe it was our installation that was the issue and it was.

Sourcetree and Bitbucket Server now works and the error went away.

For anyone that is having this issue, I would recommend installing a brand new instance of your Bitbucker Server and SourceTree, then ensure that both installations went successfully. Afterwards you can migrate your repositories using these commands.

git clone --mirror URL

git push --mirror NEW URL

Many thanks for the Atlassian Team for reaching out

comments: author: Ana Retamal
body: Glad you figured this out, Robert! Have a nice day :)

Ana


Tags: bitbucket

bitbucket-server

mac