换了新电脑,配置了git的ssh keys之后就没怎么动过了,反正配置轻车熟路,就没有测试过。
今天更新一个项目的时候,怎么都更新不了,提示如下:
> git clone git@github.com:xxxxx/xxx
Cloning into 'xxx'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
>
重新检查了密钥对和.ssh的config,都没问题,但是就是报错,折腾了几次,忽然想到一个细节,就是之前试过linux服务器下,ssh的key文件权限必须是400,就是仅限当前用户可读,打开密钥列表一看,果然:
> cd ~/.ssh
> ll