Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with caching server host key

John Girgenti
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 4, 2024

Hello all,

I have a clean install of Sourcetree on a Windows 10 computer, using a backup of my bookmarks with repositories linked to BitBucket for the remote server. I created a new SSH key

  • Saved Public and Private keys
  • Exported Converted key to C:\Users\{username}\.sshid_rsa
  • Added key to Pageant
  • Added key to Bitbucket > Personal Settings > SSH Key

I've done this on multiple computers in the past two years with no issues and no additional configurations, now I am getting this:

In Sourcetree I went to Push changes to BitBucket and I get

git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks push -v BitBucket master:master
Pushing to ssh://bitbucket.org/xxx/xxx.git
The host key is not cached for this server:
bitbucket.org (port 22)
You have no guarantee that the server is the computer
you think it is.
The server's ssh-ed25519 key fingerprint is:
ssh-ed25519 255 SHA256:ybgmFkzwOSotHTHLJgHO0QN8L0xErw6vd0VhFA9m3SM
If you trust this host, enter "y" to add the key to

Completed with errors, see above.
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) fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

The server's fingerprint matches BitBuckets' public fingerprint from https://support.atlassian.com/bitbucket-cloud/docs/configure-ssh-and-two-step-verification/

If I use the git command in the Git Terminal it's successful

$ git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks push -v BitBucket master:master
Pushing to ssh://bitbucket.org/xxx/xxx.git
Enter passphrase for key '/c/Users/{username}/.ssh/id_rsa':
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 16 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 615 bytes | 205.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0), pack-reused 0
To ssh://bitbucket.org/xxx/xxx.git
486c182..6748c46 master -> master
updating local tracking ref 'refs/remotes/BitBucket/master'

Why does the Terminal work but not Sourcetree?

TIA - John

1 answer

0 votes
Martin Runge
Community Champion
May 17, 2026

Hi @John Girgenti

Welcome to the community.

 The reason you are hitting this error is a classic interactive terminal trap.
Your logs show that Sourcetree is using PuTTY/Plink as its SSH client. Because this is a fresh setup, PuTTY is prompting you to trust Bitbucket’s host key. Because Sourcetree runs these Git commands silently in the background, there is no way for you to actually type "y". The connection simply times out and fails.

  • Manually cache the key using PuTTY/Plink (Quickest Fix)
    You need to answer that "y" prompt manually using the command line so the key gets saved to your Windows Registry. Open your Windows Command Prompt (cmd) and run the following command to force a connection via Plink: plink git@bitbucket.org
    You will see the exact same prompt asking if you want to trust the host. Type y and hit Enter. Once it says the key is cached, close the command prompt and try pushing from Sourcetree again.
  • I personally would switch Sourcetree to use OpenSSH
    Managing Pageant and PuTTY registry keys can be clunky. Windows 10 includes a native OpenSSH client, which Sourcetree seamlessly supports. In Sourcetree, go to Tools > Options > General > SSH Client Configuration and change the SSH Client dropdown from PuTTY / Pageant to OpenSSH.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events