SSH error: permissions are too open

我的 git 版本在 1.8.3.1 的时候提交 push 代码时一直报错

git 版本

Permission denied (publickey)

shell

Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

排查了几个小时,一直没解决,之前也一直是这么用的,也没出现过问题。后来没办法,我尝试更新了下 git 版本到 2.39.2,发现错误提示不一样了😢

Permissions are too open

shell

Warning: Permanently added '192.168.40.233' (ECDSA) to the list of known hosts.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0755 for '/tmp/tmp.LGAlGyMvNs/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 "/tmp/tmp.LGAlGyMvNs/id_rsa": bad permissions
Permission denied (publickey).
致命错误:无法读取远程仓库。

请确认您有正确的访问权限并且仓库存在。

我根据Permissions 0755 for '/tmp/tmp.LGAlGyMvNs/id_rsa' are too open. google 了下,原来是 isa 文件权限给的太高了,改成 400 或是 600 就可以了。

问题解决