Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,365,313
Community Members
 
Community Events
168
Community Groups

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

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.

6 answers

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. 

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!

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!

Thanks from Japan! I could resolve the same problem.

Feito!!

Muito obrigado. Funcionou aqui

Thanks from Brazil

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

Hey!

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

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.

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

Thanks. You save my day!

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 😁

Thanks!!! Work's for me 😁

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! 

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




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.

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

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

Atlassian Community Events