解决Failed to add the host to the list of known hosts

遇到第一个错误可能是

    Macintosh:Permissions 0755 for '/User/xxxx/.ssh/id_rsa' are too open.
    Linux:Permissions 0755 for '/home/xxxx/.ssh/id_rsa' are too open.

这是说你的私钥权限太大,所以需要只有你来操作

    sudo chmod 600 ~/.ssh/id_rsa sudo chmod 600 ~/.ssh/id_rsa.pub

遇到下面这种情况说明的known_hosts文件的权限有问题

    Are you sure you want to continue connecting (yes/no)? yes Failed to add the host to the list of known hosts

执行这行命令

    sudo chmod 644 ~/.ssh/known_hosts

最后你需要把你的.ssh文件夹的权限设置正确,执行下面命令

    sudo chmod 755 ~/.ssh

这样你的.ssh文件夹和里面的私钥和公钥权限问题就解决了!

你可能感兴趣的:(解决Failed to add the host to the list of known hosts)