Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

SourceTree error: The server's host key is not cached in the registry.

Markus Bonn
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 18, 2020

In a brand new installation of SourceTree on a brand new WIndows 10 I am getting and error for push/pull/fetch etc :

 

git -c diff.mnemonicprefix=false -c core.quotepath=false fetch origin
The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 aa:d1:aa:00:bb:c0:b0:a0:d0:e0:f0:a0:a1:00:11:ee
If you trust this host, enter "y" to add the key to
PuTTY's cache and carry on connecting.
If you want to carry on connecting just once, without
adding the key to the cache, enter "n".
If you do not trust this host, press Return to abandon the
connection.

A solution to this is described here:

https://confluence.atlassian.com/sourcetreekb/trust-a-server-s-host-key-when-no-button-is-available-to-trust-it-788731545.html

 

But this does not resolve the problem. The solution offers two workarounds:

1) "Just get SourceTree to use Embedded Git and get it to trust the host"

When I do this I am not prompted to trust the host. It simply switches to Embedded without any more messages or confirmations.

2) Run the command

"C:\Program Files (x86)\Atlassian\SourceTree\tools\putty\plink.exe" bitbucket.org

When I do this, I am indeed prompted to trust the server. After I enter yes, I am prompted for a login. I have no idea what to enter here. But any login I can imagine, such as for my bitbucket account fails :

FATAL ERROR: Disconnected: No supported authentication methods available (server sent: publickey)

 

BTW, the command line versions of the git commands work fine

 

Any help in this matter would be appreciated.

17 answers

2 accepted

53 votes
Answer accepted
Rachel Sutherland
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 23, 2022

I was able to fix this in Windows 11 by running the following code in the command line (Sourcetree is installed in a different location than most programs by default apparently):

"C:\Users\username\AppData\Local\SourceTree\app-3.4.8\tools\putty\plink.exe" bitbucket.org

Change "username" to your PC username, and change "app-3.4.8" to the appropriate folder with your version of sourcetree. 

Then you'll get this:

 The server's host key is not cached. You have no guarantee
that the server is the computer you think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 SHA256:[removed - but this will show your rsa key]
If you trust this host, enter "y" to add the key to
PuTTY's cache and carry on connecting.
If you want to carry on connecting just once, without
adding the key to the cache, enter "n".
If you do not trust this host, press Return to abandon the
connection.
Store key in cache? (y/n, Return cancels connection, i for more info)

Type y and click enter.

Then when it prompts for your login,

 login as:

...enter your bitbucket username and press enter. 

I got this response (and pressed enter),

Access granted. Press Return to begin session.
Server refused to allocate pty
authenticated via ssh key.

You can use git to connect to Bitbucket. Shell access is disabled

...and was able to clone just fine after that. 

David Brady
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 23, 2022

Thank you very much. I have been banging my head for several hours with this problem. Two things that were different for me:

  1. login as: did not work. I entered my bitbucket username and received "no supported authentication methods available". But it seems to have added the server's key.
  2. I had to reboot the laptop. Until I did that I still could not clone. But after booting I could.

Thanks again!

Like # people like this
Daniel Best
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 29, 2022

Yes! Lets go Rachel!

I have been looking for that tools folder in my Sourcetree app for a full day now. If you are reading this with version 3.4.8 installed the article above not longer applies to you. you will need to use Rachel's instructions instead.

Thank a bunch Rachel!

Like John Khoury likes this
Katsuragawa Naoyuki
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 2, 2022

Thanks from Japan! I could resolve the same problem.

André Saldanha
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 17, 2022

Feito!!

Muito obrigado. Funcionou aqui

Thanks from Brazil

Rachel Sutherland
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 11, 2022

I wanted to add an update because I recently tried to my repo for Sourcetree in a Parallels virtual machine, and got the same error that this person was mentioning above:

FATAL ERROR: No supported authentication methods available (server sent: publickey)

I decided to try using OpenSSH instead of Putty, and that fixed the issue. To do that, just follow the instructions under "Set up SSH for Git on Windows" at this link:
Set up an SSH key | Bitbucket Cloud | Atlassian Support

Note that you'll need to install Git for Windows if you want to run the commands outside of Sourcetree:
Git for Windows

After you've setup an ssh key with those instructions and verified the configuration, open sourcetree and go to Tools>Options. Under the "General" tab select "OpenSSH" for the SSH client. You can then browse for your ssh key, which should be in: 

C:\Users\username\.ssh
Like # people like this
DUMAR HIDALGO
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 9, 2022

Hey!

I saw this answer right after solving the issue the exact same way. Thank you very much for posting it!

solutionengineers
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 9, 2022

I also had the same issue :(

Just running the "plink.exe" program, and answering "y" to adding to the cache, was enough to unblock Sourcetree :) I didn't need to log in or anything (I'd already set up my ssh key & other info in SourceTree.

Like David Pezet likes this
kevin monteclar
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 7, 2022

Thank you for posting this solved my problem!

Sundara Raman, Vidhyalakshmi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 22, 2022

Switching to OpenSSH worked for me. 
Thanks from India!

Like Marisa Singwongwattana likes this
ToM December 2, 2022

Perfect, thank you very much!

Domicio.Medeiros
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 7, 2022

It is better to switch to open ssh. Much simpler to use. You can do that going to Tools > Options > General then change SSH Client to OpenSSH.

Like # people like this
BAMxJustin
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 15, 2023

Thank you!!!

cityshark
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 27, 2023

Worked. Thanks :)

Jeremy Smith
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 27, 2023

I had the same error -- installing putty also fixes this fatal error.

John Khoury
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 1, 2023

thank you so much!!!!!

Rachael Affenit Hudson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 24, 2023

Thank you so much, I've been trying to figure this out for several days <3

CBI
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 18, 2023

Thanks !!!!!!!!!!!! <3

3 votes
Answer accepted
Rico Steemers
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 14, 2022

Hey, y'all!

If anyone in 2022 is getting this exact issue, I found another way that fixed it for me. I had the same scenario as the poster (Fresh Windows 11 installation) and I couldn't clone any repos

So this is what I did

1. Open SourceTree and navigate to Tools > Options > Authentication
2. Click on your account and click "Set as default" (Rest Saved Passwords & Git Saved Passwords will appear)
3. Delete everything (starting from the bottom, deleting Account last)
4. Restart SourceTree and go back to Authentication and add your account again

Now, the cache prompt will properly appear while fetching your private key.
This method may not work for everyone but it did for me 😁

Juancho Marengo
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 8, 2022

Thanks!!! Work's for me 😁

Like # people like this
7 votes
Marvin.Nachatelo
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 5, 2020

For others that may be having the issue, this is how I was able to get past it.

I was able to correct this by downloading and installing putty onto my windows 10 laptop.  I then made a connection to my git server and answered the question with a yes.

Marv

RYAN
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 4, 2021

Thanks. You save my day!

Like Cédric PONSDESSERRE likes this
Cédric PONSDESSERRE
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 21, 2023

Thanks too !

Sam Hayden
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 29, 2023

Worked for me, thanks!

4 votes
Sandeep Kumar
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 7, 2023

Changed the SSH client from Putty to OpenSSH will work. you can go there  Tools -> General ->SSH Client

wei yuan
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 28, 2023

it's work for me ,think you very much

David Lukowski
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 11, 2024

Bump

Charles Robertson April 22, 2024

This worked for me and is by far the easiest, least destructive solution.

I would suggest everyone tries this first, before deleting accounts etc, as suggested in a previous solution:

https://community.atlassian.com/t5/Sourcetree-questions/Re-SourceTree-error-The-server-s-host-key-is-not-cached/qaq-p/2028547/comment-id/41794#M41794 😮

Thanks very much. 😊

Brian Arizmendi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 27, 2024

Worked for me too! Thank you very much

1 vote
lfmcmillan
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 20, 2024

The solution didn't help me at all. It turned out all I needed to do was switch my SourceTree ssh client from Putty/Plink to OpenSSH and it immediately found my usual SSH key that I use for connecting to Github, and I was able to push from sourcetree etc.

1 vote
grrbm2
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 27, 2022

Also another working solution (September/2022):

if you were using a ssh key previously generated with "ssh-keygen", for example and that key

exists at path "C:\Users\<username>\.ssh", you can import that key with PuTTy, and it will work.

Click Tools > Create or Import SSH Keys,

then click "Load", on the popup choose file type "All Files" and choose your private key, usually called "id_rsa" (not id_rsa.pub - that's the public key)

It will load and tell you to click Save Private Key to save in putty's format (.ppk). 

Do it and save the newly converted .ppk key, then run "pageant" (the thing that loads your ssh keys on sourcetree) - Tools > Launch SSH Agent, then double-click its icon in the Notification Area.

Load your converted key on Pageant by clicking Add Key and looking for "convertedKey.ppk".

Done. Now you should be able to push via SourceTree !

 



pageant.png




grrbm2
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 27, 2022

Update: After testing a bit I found that PuTTy loses your key every time, and you have to reload it. A better option would be to just change the SSH client from PuTTy to OpenSSH

(Tools > Options then change SSH Client in SSH Client Configuration section)

Now it works every time without problems.

Like # people like this
solutionengineers
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 28, 2023

Bit of a late reply here... You're right that OpenSSH is better, in every single way: But you /can/ make PuTTy start up with a loaded key. Regrettably I can't recall exactly how (I've switched completely to Linux now & as a result I can no longer use SourceTree - at least until Atlassian port it to Linux (PLEASE?)); but there's a command line option you can use... I put a shortcut into my startup folder which was something like 'putty.exe -o keyfile.key' (like I say, it's been a couple of years, the exact magic I cannot remember).

 

Hope that helps someone, especially if you've no choice but to use PuTTy.

Like grrbm2 likes this
1 vote
Charlie Galik
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 8, 2022

I could not get passed this problem either (Windows 10 fresh install). HTTPS worked, but I needed SSH as well. The above solutions I could not get to work. What I ended up doing is opening up Putty, ssh into the server (remember to get username and port set right), trust the host by hitting "y". Then go back to Sourcetree and WIN! Maybe will help someone else too. Good luck! 

0 votes
簡維熠
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 19, 2023

Thanks Rachel for sovling our issues. You really made my day!

0 votes
Admin
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 5, 2023

Right on Rachael!  Perfect solution and easy.

0 votes
Martin Pro (Scalios)
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 13, 2023

For everyone who is struggling with this error on BitBucket SERVER (on prem) or who has Custom Ports.

I wasted almost 2 days on this error, the important difference, at least for me, wasthat i constantly got an "access denied" error with the plink command.

I finally did it by coincidence, because i tried from another site this complete command with password included:

plink.exe -ssh -pw "YourPassword" username@YourOnPremBitBucketServerURL

The breakthrough was adding the port parameter -P. Our admin team choose 7999. I think most use 2222. You can find your port in BitBucket Admin / Server settings.

With the port it finally worked, here the complete command:

plink.exe -ssh -pw "YourPassword" username@YourOnPremBitBucketServerURL -P YourPort


Just for complete documentation, as many above wrote the plink.exe can be found in the install directory of SourceTree or Putty:

- SourceTree: C:\Users\USERNAME\AppData\Local\SourceTree\app-SOURCETREEVERSION\tools\putty

- Putty: C:\Program Files\PuTTY

0 votes
adina-alexandra_Pinzaru
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 16, 2023

After running the following command i received : FATAL ERROR: Network error: Connection timed out. 

"C:\Users\username\AppData\Local\SourceTree\app-3.4.8\tools\putty\plink.exe" bitbucket.org

 

Do you have any idea?

Thanks

0 votes
Wahab Hussain
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 26, 2022

Try opening the terminal by going into Action --> Open In Terminal
Then within the terminal paste the git repo URL you will be prompted to accept the server finger print. 

Type yes and enter. Server fingerprint will be cached.

0 votes
Domicio.Medeiros
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 7, 2022

It is better to switch to open ssh. Much simpler to use. You can do that by going to Tools > Options > General then change SSH Client to OpenSSH.

0 votes
hegedus.g
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 7, 2022

Should anyone still care:

Exact same error message (y/n cache stuff) deleting the local repo and recloning of those with such error msg  helped me out...... 

0 votes
Sean Lively October 28, 2022

@Daniel Eads Since we can't report bugs anymore: https://community.atlassian.com/t5/Sourcetree-questions/how-do-i-report-a-bug-in-sourcetree/qaq-p/1164591

Is this issue in your bug tracker anywhere? I had this exact problem today with a new developer, fresh Windows 10 install, fresh SourceTree install.

0 votes
Otemu Akpobaro
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 7, 2022

This is the method that worked for me, taken from stack overflow:

The way to add bitbucket as a host to PuTTY's cache is to run the

following command:

plink.exe bitbucket.org

Just answer y, and then Ctrl+C, ignore the rest

Original Source

0 votes
tregdor
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 2, 2022

I'm struggling with this as well. The command line plink caching technique has worked elsewhere but for whatever reason I have one machine on which this doesn't work. git bash finds credentials and repeated plink suggests that it finds the cached key as well. Only sourcetree believes the key is not cached. Using the embedded git does not change anything. 

Using SourceTree 3.4.9

Christopher Berger
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 7, 2022

For me worked what others have already pointed out.

Run the following command, replace <DestinationFQDN> with your actual server address.

%LOCALAPPDATA%\SourceTree\app-3.4.9\tools\putty\plink.exe <DestinationFQDN>

e.g.

%LOCALAPPDATA%\SourceTree\app-3.4.9\tools\putty\plink.exe gitlab.contoso.lan

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events