The authenticity of host 'github.com (192.30.252.128)' can't be established

前端 未结 7 1442
慢半拍i
慢半拍i 2020-12-12 19:08

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

How

相关标签:
7条回答
  • 2020-12-12 19:44

    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?

    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

    0 讨论(0)
  • 2020-12-12 19:44

    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 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.

    NPM interprets the last "package" as being a github repo and that is where the error comes from.

    I know this does not actually answer the question but I put it up just in case anyone else encounters this by making a similar mistake.

    0 讨论(0)
  • 2020-12-12 19:46

    Danger ahead, unless you actually don't care about secure communication with github on your local account

    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.

    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.

    Option 2 is have ssh access work.

    Okay, show me option 2

    Do ssh -T git@github.com 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).

    If the hash matches, then connection is indeed safe you can answer "yes" to ssh's question.

    Okay, I checked and typed yes, how do I know it works?

    Ssh will show something like:

    Warning: Permanently added the RSA host key for IP address '192.30.252.128' to the list of known hosts.

    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.

    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.

    0 讨论(0)
  • 2020-12-12 19:46

    I had same problem, you have just to add your SSH key to the ssh-agent, see this link :

    https://help.github.com/articles/checking-for-existing-ssh-keys/

    it worked with me.

    0 讨论(0)
  • 2020-12-12 19:49

    Run ssh -o StrictHostKeyChecking=no git@github.com in command prompt to add the authenticity to your known_hosts. Then you won't get the prompt the next time.

    0 讨论(0)
  • 2020-12-12 20:03

    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).

    0 讨论(0)
提交回复
热议问题