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

前端 未结 7 1463
慢半拍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: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.

提交回复
热议问题