当前位置: 首页 > article >正文

git通过ssh方式操作提示Permission denied (publickey). 【解决】

问题:

C:\Users\admin>git clone "ssh://xxxx.com:22518/xxxx"
Cloning into 'xxxx'...
xxx@xxxxx.com: Permission denied (publickey).
fatal: Could not read from remote repository.

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

问题解决:

1 首先检查上传的ssh的公钥是否正确,注意不要多了换行符

2 通过命令查看

C:\Users\admin>ssh -v xxxx@xxxx.com -p 22518
....
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: C:\\Users\\admin/.ssh/id_rsa RSA SHA256:HPF6dYbfpIyS9fUIY0Q6upoXs+ccffkg3Ju9KF0Qy/0
debug1: send_pubkey_test: no mutual signature algorithm
debug1: Trying private key: C:\\Users\\admin/.ssh/id_ecdsa
debug1: Trying private key: C:\\Users\\admin/.ssh/id_ecdsa_sk
debug1: Trying private key: C:\\Users\\admin/.ssh/id_ed25519
debug1: Trying private key: C:\\Users\\admin/.ssh/id_ed25519_sk
debug1: Trying private key: C:\\Users\\admin/.ssh/id_xmss
debug1: Trying private key: C:\\Users\\admin/.ssh/id_dsa
debug1: No more authentication methods to try.

从上面的提示钟看到 “debug1: send_pubkey_test: no mutual signature algorithm”,也需要检查公钥是否显示algorithm算法

这表示没有无相互签名算法

采用命令查看是否成功,指定指定公钥认证所接受的密钥类型PubkeyAcceptedKeyTypes=+ssh-rsa

C:\Users\admin>ssh -o PubkeyAcceptedKeyTypes=+ssh-rsa -v xxxx@xxxx.com -p 22518
....
debug1: ENABLE_VIRTUAL_TERMINAL_PROCESSING is supported. Console supports the ansi parsing

  ****    Welcome to Gerrit Code Review    ****

  Hi liulun_ext, you have successfully connected over SSH.

  Unfortunately, interactive shells are disabled.
  To clone a hosted Git repository, use:

  git clone ssh://xxx@xxxx.com:22518/REPOSITORY_NAME.git

可以看出成功了

3 找到问题,开始完美解决

在你的.ssh文件夹中,新建config文件

Host *
  HostkeyAlgorithms +ssh-rsa
  PubkeyAcceptedKeyTypes +ssh-rsa

4 效果

C:\Users\admin>git clone "ssh://xxxx@xxxx.com:22518/xxxx"
Cloning into 'xxxx_service'...
remote: Counting objects: 340, done
remote: Finding sources: 100% (273/273)


http://www.kler.cn/news/358754.html

相关文章:

  • 论文阅读-三维结构几何修复(导-4)
  • uniapp 整合 OpenLayers - 加载Geojson数据(在线、离线)
  • [Java基础] 集合框架
  • 数字处理系列
  • 51单片机快速入门之 LCD1602 液晶显示屏 结合 数字键盘的运用 2024/10/20
  • Linux 使用 Split 命令分割文件与合并
  • 13.4 Linux_网络编程_套接字属性
  • 【设计模式系列】装饰器模式
  • 自动驾驶系列—CI在自动驾驶开发中的应用场景与实现详解
  • 说了很久的建筑转大模型,也不过是想在职场完成赎身
  • 深入理解Flutter鸿蒙next版本 中的Widget继承:使用extends获取数据与父类约束
  • SpringBoot框架的车辆管理自动化解决方案
  • 「漏洞复现」英飞达医学影像存档与通信系统 WebUserLogin.asmx 信息泄露漏洞
  • OpenCV的常用与形状形状描述相关函数及用法示例
  • VSCODE c++不能自动补全的问题
  • Qt- JSONXML
  • 高频SQL50题(基础版)三
  • 安全升级:索尔德三款产品获得防爆合格证
  • 知识付费专业知识讲解
  • springboot优质鸭梨的培育管理系统-计算机毕业设计源码92834