git - 服务器主机密钥未被缓存 [英] git - Server host key not cached

查看:1036
本文介绍了git - 服务器主机密钥未被缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将更改从本地回购推送到远程回购。当我输入:

  git push origin 

我得到以下错误:

 服务器的主机密钥未缓存在注册表中。您
不能保证服务器是您
认为它的电脑。
服务器的rsa2密钥指纹是:
ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
连接被放弃。
致命:远程终端意外挂起

我该如何解决这个问题?我在Windows 7的命令行中使用了git。



编辑

当我尝试做一个简单的ssh时

  ssh user @ hostname 

我得到以下错误:

 无法创建目录'/c//%HOMEDRIVE%%HOMEPATH%/.ssh'。 
percent_expand:未知键%H

不知何故,它不会创建目录,因为路径是无效的。如何解决这个问题?

@eckes: Edit2



%HOMEDRIVE %% HOMEPATH%是否正确?

解决方案

消息表示 origin 的主机密钥不存在于您的可信主机文件中。



为了解决这个问题,打开一个纯SSH连接到 origin ,SSH会问你是否要信任远程主机(从Git控制台):

  $ ssh 127.0.0.1 
无法建立主机'127.0.0.1(127.0.0.1)'的真实性。
RSA密钥指纹是< FINGERPRINT> ;.
您确定要继续连接(是/否)吗?

如果您信任远程主机(即键入 yes ),SSH会将其密钥添加到已知主机列表中。



之后,您应该可以执行 git push origin 。



另外,您也可以手动添加原点的键到 .ssh / known_hosts 但这需要您遵守 known_hosts 文件的格式,如 sshd (第 AUTHORIZED_KEYS FILE FORMAT )。


I try to push changes from my local repo to a remote repo. When I type:

git push origin

I get the following error:

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

How can I solve this? I'm using git from the command line in Windows 7.

Edit

When I try to do a simple ssh

ssh user@hostname

I get the following error:

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

Somehow it will not create the directory, because the path is invalid. How to fix this?

@eckes: Edit2

My Home is set to %HOMEDRIVE%%HOMEPATH% is this correct?

解决方案

The message means that the host key of origin is not present in your trusted hosts file.

To get around this, open a plain SSH connection to origin and SSH will ask you if you want to trust the remote host (from the Git console):

$ 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)?

If you trust the remote host (i.e. type yes), SSH will add its key to the list of known hosts.

After that, you should be able to do your git push origin.

As an alternative, you could also manually add the key of origin to .ssh/known_hosts but this requires that you adhere to the format of the known_hosts file as described in the man page of sshd (Section AUTHORIZED_KEYS FILE FORMAT).

这篇关于git - 服务器主机密钥未被缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆