node.js 无法建立主机'github.com(192.30.252.128)'的真实性
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18710120/
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
The authenticity of host 'github.com (192.30.252.128)' can't be established
提问by led
I am trying to use
我正在尝试使用
sudo npm install
to install all my dependencies for an application written in nodejs. My OS is Ubuntu 13.04
为用 nodejs 编写的应用程序安装我的所有依赖项。我的操作系统是 Ubuntu 13.04
However, I keep getting this warning:
但是,我不断收到此警告:
The authenticity of host 'github.com (192.30.252.131)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:1d:52:13:1a:21:2d:bz:1d:66:a8.
Are you sure you want to continue connecting (yes/no)?
Has anyone encountered this warning before? Is it possible to authenticate and store the fingerprint locally? So I won't need to authenticate again when I enter sudo npm install another time.
有没有人遇到过这个警告?是否可以在本地验证和存储指纹?因此,当我再次输入 sudo npm install 时,我不需要再次进行身份验证。
Right now, I am unable to enter anything, not even "yes". My terminal just gets stuck, i have to press ctrl+c to terminate.
现在,我无法输入任何内容,甚至无法输入“是”。我的终端卡住了,我必须按 ctrl+c 才能终止。
采纳答案by Stéphane Gourichon
Danger ahead, unless you actually don't care about secure communication with github on your local account
前方有危险,除非您实际上不关心与本地帐户上的 github 的安全通信
Ssh rightly complains that they can't make sure you are indeed connecting to github's server through a secure channel. That might be why github is recommending https access, which works out-of-the-box thanks to its public key infrastructure.
Ssh 正确地抱怨他们无法确保您确实通过安全通道连接到 github 的服务器。这可能就是 github 推荐 https 访问的原因,由于其公钥基础设施,它可以开箱即用。
Now, you can have it work, but be aware that it involves caching a public key fingerprint which, if done incorrectly, provides an attacker permanent man-in-the-middle attack.
现在,您可以让它工作,但请注意,它涉及缓存公钥指纹,如果操作不当,会为攻击者提供永久的中间人攻击。
How to proceed safely?
如何安全进行?
Option 1 is use https url instead of ssh.
选项 1 是使用 https url 而不是 ssh。
Option 2 is have ssh access work.
选项 2 是有 ssh 访问工作。
Okay, show me option 2
好的,告诉我选项 2
Do ssh -T [email protected]but don't just type "yes". Check if the hash that is shown matches one of the hashed shown in https://help.github.com/articles/what-are-github-s-ssh-key-fingerprints/(in your question it does, and see, the page is fetched through https for the same public key infrastructure reasons).
做ssh -T [email protected]但不要只输入“是”。检查显示的哈希值是否与https://help.github.com/articles/what-are-github-s-ssh-key-fingerprints/ 中显示的哈希值之一匹配(在您的问题中,它确实如此,并查看,出于相同的公钥基础结构原因,该页面是通过 https 获取的)。
If the hash matches, then connection is indeed safe you can answer "yes" to ssh's question.
如果哈希匹配,那么连接确实是安全的,您可以对 ssh 的问题回答“是”。
Okay, I checked and typed yes, how do I know it works?
好的,我检查并输入 yes,我怎么知道它有效?
Ssh will show something like:
ssh 将显示如下内容:
Warning: Permanently added the RSA host key for IP address '192.30.252.128' to the list of known hosts.
警告:已将 IP 地址“192.30.252.128”的 RSA 主机密钥永久添加到已知主机列表中。
After that, you will either see a message like
之后,您将看到一条消息,如
Permission denied (publickey).
权限被拒绝(公钥)。
which is good but shows that you need further configuration, or simply
这很好,但表明您需要进一步配置,或者干脆
Hi yourlogin! You've successfully authenticated, but GitHub does not provide shell access.
嗨您的登录!您已成功通过身份验证,但 GitHub 不提供 shell 访问。
which means that all works well and you can retry your first operation.
这意味着一切正常,您可以重试您的第一个操作。
Notice that if you retry the same ssh command, it should no longer ask the question.
请注意,如果您重试相同的 ssh 命令,它不应再提出问题。
回答by Kent Mewhort
Run ssh -o StrictHostKeyChecking=no [email protected]in command prompt to add the authenticity to your known_hosts. Then you won't get the prompt the next time.
ssh -o StrictHostKeyChecking=no [email protected]在命令提示符下运行以将真实性添加到您的 known_hosts。这样下次就不会收到提示了。
回答by Matt Pavelle
You sure you're not accidentally logged in as a different user (this happens to me when I sudo -s / login as root and forget my GitHub account isn't linked to that user).
您确定您没有意外以其他用户身份登录(当我 sudo -s / 以 root 身份登录并忘记我的 GitHub 帐户未链接到该用户时,会发生这种情况)。
回答by joshua-anderson
Github just made changes to their ip address infrastructure. You can read here for more details https://github.com/blog/1606-ip-address-changes. Also, I have never seen a problem like this before. Is you package.json containing a git depency cloned via ssh?
Github 刚刚更改了他们的 IP 地址基础设施。您可以在此处阅读更多详细信息https://github.com/blog/1606-ip-address-changes。另外,我以前从未见过这样的问题。您是否包含通过 ssh 克隆的 git 依赖项的 package.json?
Try echo 'yes' | sudo npm install. This may solve your problem. If it does not, try cloning via HTTPS instead or download the module as a tarball instead, which can be done like this https://api.github.com/repos/username/reponame/tarball
试试echo 'yes' | 须藤 npm 安装。这可能会解决您的问题。如果不是这样,而是尝试通过HTTPS克隆或下载模块作为一个压缩包,而不是,它可以这样做https://api.github.com/repos/的用户名/ reponame/压缩包
回答by MarioDS
I landed here because I was getting this error and not understanding why. It turns out I had a typo in my npm command:
我来到这里是因为我遇到了这个错误并且不明白为什么。事实证明我的 npm 命令中有一个错字:
npm install -P -E @angular/common @angular/compiler @angular/core @angular/forms
@angular/platform-browser @angular/router @angular/animations@ angular/platform-browser-dynamic
Notice how the end of the line reads @angular/animations@ angular/platform-browser-dynamic.
注意行尾如何读取@angular/animations@ angular/platform-browser-dynamic。
NPM interprets the last "package" as being a github repo and that is where the error comes from.
NPM 将最后一个“包”解释为 github 存储库,这就是错误的来源。
I know this does not actuallyanswer the question but I put it up just in case anyone else encounters this by making a similar mistake.
我知道这实际上并没有回答这个问题,但我提出来以防万一其他人因犯类似的错误而遇到这个问题。
回答by user71404
Run ssh github.comand type yes and it should fail. Then run your command again. If not try ssh github.comagain as they have multiple IP's and you might need all of them.
运行ssh github.com并输入 yes ,它应该会失败。然后再次运行您的命令。如果没有再试ssh github.com一次,因为他们有多个 IP,您可能需要所有 IP。
回答by nmoumene
I had same problem, you have just to add your SSH key to the ssh-agent, see this link :
我遇到了同样的问题,您只需将 SSH 密钥添加到 ssh-agent,请参阅此链接:
https://help.github.com/articles/checking-for-existing-ssh-keys/
https://help.github.com/articles/checking-for-existing-ssh-keys/
it worked with me.
它和我一起工作。

