未缓存的git-服务器主机密钥?

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (2)
  • 关注 (0)
  • 查看 (49)

我尝试将更改从本地回购推送到远程回购。当我打字时:

git push 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 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
Connection abandoned.
fatal: The remote end hung up unexpectedly

我怎么解决这个问题?我正在使用Windows 7命令行中的git。

当我尝试做一个简单的ssh

ssh user@hostname

我得到以下错误:

Could not create directory '/c//%HOMEDRIVE%%HOMEPATH%/.ssh'.
percent_expand: unknown key %H

因为路径无效,所以它不会创建目录。怎么解决这个问题?

我设置为%HOMEDRIVE%%HOMEPATH%这是对的吗?

提问于
用户回答回答于

消息意味着origin在受信任的主机文件中不存在。

要解决这个问题,请打开一个普通的SSH连接到originSSH将询问您是否希望信任远程主机(从Git控制台):

$ ssh 127.0.0.1
The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
RSA key fingerprint is <FINGERPRINT>.
Are you sure you want to continue connecting (yes/no)?

如果信任远程主机(即键入yes),SSH将输入已知主机列表的键。

在那之后,你应该可以git push origin

作为替代,还可以手动添加origin.ssh/known_hosts但是,这要求遵循known_hosts的手册页中描述的sshd(条)。

用户回答回答于

对于那些通过标准命令提示符在Windows上使用PuTTY设置MSYS Git的人,将主机添加到PuTTY缓存的方法是运行

> plink.exe <host>

例如:

> plink.exe codebasehq.com

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 2e:db:b6:22:f7:bd:48:f6:da:72:bf:59:d7:75:d7:4e
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)

扫码关注云+社区