记 Git - Permission denied (publickey) 问题

知了小站
2022-07-21 / 1 评论 / 395 阅读

最近在 Centos 9 stream 上使用 ssh-keygen -t rsa -C "email" 生成密钥,在 coding 添加公钥后 clone 代码出现如下问题

git@e.coding.net: Permission denied (publickey).
fatal: Could not read from remote repository.

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

将密钥复制到本地电脑上进行测试,发现可以成功 clone 项目。

通过搜索发现 csdn 没有一个答案能解决问题(全是重复的文章),最后在国外网站找到了解决办法

解决方案

不使用 rsa 算法生成密钥,使用更安全的 ECDSA 或 ED25519 生成

ssh-keygen -t ed25519 -C "email"

coding 重新添加后,成功 clone 了项目。感觉可能是 OpenSSH 版本问题,有时间再测测看。

参考:https://confluence.atlassian.com/bitbucketserverkb/ssh-rsa-key-rejected-with-message-no-mutual-signature-algorithm-1026057701.html

本文共 136 个字数,平均阅读时长 ≈ 1分钟
2

打赏

评论 (1)

取消
  1. 头像
    淄博
    Windows 10 · Google Chrome

    感谢分享,赞一个

    回复