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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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,556,800
Community Members
 
Community Events
184
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.

13 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!

Like # people like this

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.

Thank you for posting this solved my problem!

Switching to OpenSSH worked for me. 
Thanks from India!

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!
Dec 07, 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

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!

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!
Apr 21, 2023

Thanks too !

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 😁

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.

Like Jonathan Vigh likes this

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
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!
Apr 13, 2023 • edited

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

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

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!
Dec 07, 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.

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

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

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

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
AUG Leaders

Atlassian Community Events