秘密鍵(id_rsa)について、よくつまづくのでメモ。
はじめに
自分の秘密鍵を.ssh配下にコピペしてSSHでのgit cloneしたら以下のエラーが。
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/home/yu_uchida/.ssh/id_rsa' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: /home/yu_uchida/.ssh/id_rsa
Permission denied (publickey).
fatal: Could not read from remote repository.
パーミッションが too openだと怒られてます。
解決方法
chmodでパーミッションを0600にする。
$ chmod 0600 id_rsa
これでgit cloneできるようになりました。