主机密钥验证失败 SSH Github

主机密钥验证失败 SSH Github

我采取了一种相对简单的方法来尝试安全地克隆我的 GitHub 存储库,但仍然很困难。

在我的 Mac 上,我运行了 MyKey,并且没有密码

ssh-keygen -t rsa

我将公钥的内容上传到 GitHub,并赋予其读写权限。然后在服务器上运行以下命令:

cat > /root/.ssh/github.id_rsa << EOF
-----BEGIN OPENSSH PRIVATE KEY-----
The private key 
-----END OPENSSH PRIVATE KEY-----
EOF

chmod 600 /root/.ssh/github.id_rsa
    
cat > /root/.ssh/config << EOF
    Host github.com
    Hostname github.com
    IdentityFile ~/.ssh/github.id_rsa
EOF
chmod 600 /root/.ssh/config

git clone [email protected]:myname/myproject.git /var/www/test

但是我收到的错误是:

Cloning into '/var/www/test'...
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

我可能哪里做错了?

相关内容