bash Git 服务器的主机密钥未缓存在注册表中 - GitHub.com
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10166173/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Git server's host key not cached in registry - GitHub.com
提问by kentcdodds
Continuation of issue here:
I'm trying to set up my first Git Repository on GitHub. (Note, this means I can't use putty, I'm using openssh, or at least I'm supposed to and I think I am). I've been following the documentation on GitHub's website here. I get everything right up until the very last command: git push -u origin master
. It gives me the following error:
问题的延续在这里:我试图建立在GitHub上我的第一个Git仓库。(注意,这意味着我不能使用腻子,我正在使用 openssh,或者至少我应该并且我认为我是)。我一直在关注 GitHub 网站上的文档here。直到最后一个命令:git push -u origin master
. 它给了我以下错误:
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
16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
Connection abandoned. fatal: The remote end hung up unexpectedly
I'm guessing this means that in my known_hosts
file their ssh-rsa key isn't found, but I'm not sure how to fix that. I've tried ssh -T [email protected]
and I log on just fine. I've also tried closing the git bash and re-opening in case it's a cache issue. This doesn't fix the problem. This is the only output I get that differs from what the documentation indicates. I'm hoping to put up a sweet Java Helper Library, so any help would be greatly appreciated!
我猜这意味着在我的known_hosts
文件中找不到他们的 ssh-rsa 密钥,但我不确定如何解决这个问题。我试过了ssh -T [email protected]
,我登录得很好。我还尝试关闭 git bash 并重新打开,以防它是缓存问题。这不能解决问题。这是我得到的唯一与文档指示不同的输出。我希望建立一个甜蜜的 Java Helper 库,所以任何帮助将不胜感激!
采纳答案by Learath2
The ideal solution would be (if you really don't need to use plink in git) removing the GIT_SSH environment variable and generating a new keypair with command ssh-keygen -t rsa -C "youremail"
on Git Bash then change your ssh key in github because from what I've understood from the comments is putty and openssh is conflicting.
理想的解决方案是(如果您真的不需要在 git 中使用 plink)删除 GIT_SSH 环境变量并使用ssh-keygen -t rsa -C "youremail"
Git Bash上的命令生成一个新的密钥对,然后在 github 中更改您的 ssh 密钥,因为根据我从评论是腻子,而 openssh 是冲突的。
However, if you still want to use plink you can use PuTTYgen to generate a PuTTY format key then change your public key in github and load your private key in PuTTYagent then you should do a connect to github.com with PuTTY this would add githubs fingerprint to known_hosts and you are good to go. This would be a resource to github with PuTTY http://nathanj.github.com/gitguide/tour.html
但是,如果您仍然想使用 plink,您可以使用 PuTTYgen 生成 PuTTY 格式的密钥,然后在 github 中更改您的公钥并在 PuTTYagent 中加载您的私钥,然后您应该使用 PuTTY 连接到 github.com 这将添加 githubs 指纹到 known_hosts 就可以了。这将是带有 PuTTY 的 github 资源http://nathanj.github.com/gitguide/tour.html
回答by Name
Using git-for-windows with GIT_SSH pointing to plink.exe, opening a putty to the server and accepting the host key (and then killing the putty session, not even proceeding with logging in) was enough to solve this issue for me.
使用带有指向 plink.exe 的 GIT_SSH 的 git-for-windows,向服务器打开一个腻子并接受主机密钥(然后终止腻子会话,甚至不继续登录)足以为我解决这个问题。
回答by cfedermann
On Windows, it seems that sometimes you don't get to actually accept a server's host key.
在 Windows 上,有时您似乎无法真正接受服务器的主机密钥。
Try one of the following commands from the Power Shell:
从 Power Shell 尝试以下命令之一:
ssh github.com
Or
或者
plink.exe -agent github.com
Run these standalone and press y
when asked to accept the host key.
独立运行这些并y
在要求接受主机密钥时按。
Use ssh-add
to add your private key to the current Power Shell session:
使用ssh-add
你的私钥添加到当前的电源外壳会议:
C:> ssh-add PATH\TO\PRIVATE\KEY
Afterwards, you should be able to successfully run git push
.
之后,您应该能够成功运行git push
.
回答by Olivier B.
Adding info to the post of @Name (for the sake of completeness), as I just had (again) this issue today.
在@Name 的帖子中添加信息(为了完整性),因为我今天(再次)遇到了这个问题。
Putty stores its SSH known hosts in a registry key, not in the ~/.ssh/known_hosts file like SSH. So to make Git work with PLink and Pagent, you just have to start a Putty session on the remote Git server, and accept the key. This way, you won't have the message again.
Putty 将其 SSH 已知主机存储在注册表项中,而不是像 SSH 那样存储在 ~/.ssh/known_hosts 文件中。所以为了让 Git 与 PLink 和 Pagent 一起工作,你只需要在远程 Git 服务器上启动一个 Putty 会话,并接受密钥。这样,您将不会再收到该消息。
This is disturbing, as you have to accept the SSH key twice : one for SSH-ing the server, one for Putty/Plink/Pagent, but once you do it, it works like a charm.
这令人不安,因为您必须接受两次 SSH 密钥:一次用于对服务器进行 SSH 连接,一次用于 Putty/Plink/Pagent,但是一旦您接受了它,它就像一个魅力。