
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.
どこで間違えたのでしょうか?