使用 ssh 配置从 azure devops 克隆

Cloning from azure devops using ssh config

我有 2 个以上的 ssh 密钥,用于连接到不同的服务器。为了能够使用 ssh 从 azure devops 克隆,我在 ~/.ssh/ad-azure 中创建了一个 ssh 密钥并将其链接到配置文件中,如下所示。

Host vs-ssh.visualstudio.com
  HostName vs-ssh.visualstudio.com
  User amir
  IdentityFile ~/.ssh/ad-azure
  IdentitiesOnly yes
  PubkeyAcceptedKeyTypes ssh-rsa

现在当我使用 git clone ssh 时,

git clone amir@vs-ssh.visualstudio.com:v3/test/testProject

它抛出以下错误。

Unable to negotiate with 00.74.28.28 port 22: no matching host key type found. Their offer: ssh-rsa fatal: Could not read from remote repository.

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

我遵循的步骤。

  1. 已创建 ad-azure ssh 密钥
  2. 将密钥添加到 azureDevops“SSH Public 密钥”
  3. 正在尝试连接,失败

我已经研究过其他问题,对我来说似乎一切正常。有人可以发现问题吗?

this thread所述:

The OpenSSH project has removed the public key algorithm ssh-rsa as of Version 8.8. Currently, Azure Devops still only supports ssh-rsa.
For a workaround, with the OpenSSH 8.8, you can add the following to ~/.ssh/config:

Host ssh.dev.azure.com
HostkeyAlgorithms +ssh-rsa
PubkeyAcceptedAlgorithms +ssh-rsa

a ticket 请求支持更强大的算法,如 sha2。

This workaround should be considered insecure going forward because, as I mentioned on the February 2020 issue, and as the OpenSSH project has stated repeatedly, SHA-1 attacks can be accomplished for as little as k USD these days.

Please ensure that the Azure Devops host key is signed according to RFC8332 RSA/SHA-256/512 going forward.