在远程主机上使用 git 总是失败,想起来没有私钥…于是把本地的私钥 ssh 上传到远程主机,结果出现问题
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/root/.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.
Load key "/root/.ssh/id_rsa": bad permissions
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
原因是上传的私钥文件的权限是 664(rw-rw-r--) 太开放了,收敛一下权限
chmod 600 ~/.ssh/id_rsa ~/.ssh/id_rsa.pub