问题
升级了macos最新的14.1.1后,无法拉取公司git仓库,提示:
git@**.**.**.**: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
重新用ssh-keygen生成ssh key后,依然报错。但是试了github是可以正常拉取和推送代码的。
解决
后面发现是ssh-keygen的算法和邮箱没对:
ssh-keygen -t ed25519 -C "email.com"
重新生成后,放到git上更新ssh key后,正常拉取了。
原因
推测是升级系统后,ssh的兼容性问题导致。
通过此种方式生成的密钥前缀是id_ed25519,并且神奇的是和已有的github上的密钥并不冲突,而是共存的。即github上不需要增加该id_ed25519密钥,还是用原来的id_rsa.pub即可。而公司私有仓库通过id_ed25519的密钥也能正常访问。