# Sourcetree 无法上传代码 The server's host key is not cached.

今天提交代码的时候无法正常上传,查看完整输出提示。

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 ssh-ed25519 key fingerprint is:
ssh-ed25519 255 SHA256:xxxxxxx
If you trust this host, enter "y" to add the key to

但是,没有任何弹窗,也没法输入【y】。

# 解决方案

方案一:【推荐】

这是因为你用的 SSH 客户端是 PuTTY / Plink,而不是 OpenSSH,所以会有这种问题。

打开 Sourcetree,在上方菜单栏找到【工具】,然后点击【选项】。

image-20220612135818063

image-20220612135914970

修改完成后,点击确定,重新提交代码就可以了。

方案二:

执行以下命令

把【YOUR_USERNAME】换成你的用户名

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

参考文献:

SourceTree error_ The server's host key is not cac.... (opens new window)

Trust A Server's Host Key when No Button is Available to Trust It _ Sourcetree _ Atlassian Documentation (opens new window)

sourceTree 添加 ssh key 方法 - 简书 (opens new window)