无法与 XX.XXX.XX.XX 协商:找不到匹配的主机密钥类型.他们的报价:ssh-dss [英] Unable to negotiate with XX.XXX.XX.XX: no matching host key type found. Their offer: ssh-dss

查看:32
本文介绍了无法与 XX.XXX.XX.XX 协商:找不到匹配的主机密钥类型.他们的报价:ssh-dss的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的网络主机上创建一个 git 存储库并在我的计算机上克隆它.这是我所做的:

I am trying to create a git repository on my web host and clone it on my computer. Here's what I did:

  1. 我在远程服务器上创建了一个存储库.
  2. 我生成了一个密钥对:ssh-keygen -t dsa.
  3. 我已将密钥添加到 ssh-agent.
  4. 我将~/.ssh中的公钥复制到服务器.
  1. I created a repository on the remote server.
  2. I generated a key pair: ssh-keygen -t dsa.
  3. I added my key to ssh-agent.
  4. I copied to the server public key in ~/.ssh.

然后,在尝试运行命令 git clone ssh://user@host/path-to-repository 后,出现错误:

And then, after an attempt to run the command git clone ssh://user@host/path-to-repository, I get an error:

无法与 XX.XXX.XX.XX 协商:找不到匹配的主机密钥类型.他们的报价:ssh-dss
致命:无法从远程存储库读取.
请确保您拥有正确的访问权限并且存储库存在.

Unable to negotiate with XX.XXX.XX.XX: no matching host key type found. Their offer: ssh-dss
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.

这是什么意思?

推荐答案

最近的 openssh 版本默认弃用了 DSA 密钥.您应该建议您的 GIT 提供商添加一些合理的主机密钥.仅依赖 DSA 并不是一个好主意.

The recent openssh version deprecated DSA keys by default. You should suggest to your GIT provider to add some reasonable host key. Relying only on DSA is not a good idea.

作为一种解决方法,您需要告诉 ssh 客户端您希望接受 DSA 主机密钥,如 传统使用的官方文档.您的可能性很少,但我建议将这些行添加到您的 ~/.ssh/config 文件中:

As a workaround, you need to tell your ssh client that you want to accept DSA host keys, as described in the official documentation for legacy usage. You have few possibilities, but I recommend to add these lines into your ~/.ssh/config file:

Host your-remote-host
    HostkeyAlgorithms +ssh-dss

另一种可能是使用环境变量 GIT_SSH 来指定这些选项:

Other possibility is to use environment variable GIT_SSH to specify these options:

GIT_SSH_COMMAND="ssh -oHostKeyAlgorithms=+ssh-dss" git clone ssh://user@host/path-to-repository

这篇关于无法与 XX.XXX.XX.XX 协商:找不到匹配的主机密钥类型.他们的报价:ssh-dss的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆