Git未使用SSH密钥对Azure DevOps进行身份验证



我最近切换到运行工具箱的Fedora 33 Silverblue的新安装。这也发生在工具箱之外。我使用以下命令生成了SSH密钥

ssh-keygen -t rsa -b 4096 -C filbot@fenix

然后我把它上传到我账户下的Azure DevOps。但是,我无法使用以下~/.ssh/config:从Azure DevOps克隆任何内容

⬢[filbot@toolbox ~]$ cat ~/.ssh/config 
# SSH Configuration File
Host ssh.dev.azure.com
HostName ssh.dev.azure.com
User git
IdentityFile /var/home/filbot/.ssh/id_rsa
IdentitiesOnly yes
Host vs-ssh.visualstudio.com
HostName vs-ssh.visualstudio.com
User git
IdentityFile /var/home/filbot/.ssh/id_rsa
IdentitiesOnly yes

然后我运行了这些git clone命令,结果如下:

⬢[filbot@toolbox ~]$ git clone git@ssh.dev.azure.com:v3/$ORG/$PROJ/Developer.dudleyp.cs_pipeline_tasks
Cloning into 'Developer.dudleyp.cs_pipeline_tasks'...
git@ssh.dev.azure.com's password: 
⬢[filbot@toolbox ~]$ GIT_SSH_COMMAND=ssh git clone git@ssh.dev.azure.com:v3/$ORG/$PROJ/Developer.dudleyp.cs_pipeline_tasks
Cloning into 'Developer.dudleyp.cs_pipeline_tasks'...
git@ssh.dev.azure.com's password: 
⬢[filbot@toolbox ~]$ ssh -T git@ssh.dev.azure.com
Warning: Permanently added the RSA host key for IP address '20.37.158.9' to the list of known hosts.
git@ssh.dev.azure.com's password: 
⬢[filbot@toolbox ~]$ ssh -i ~/.ssh/id_rsa -T git@ssh.dev.azure.com
git@ssh.dev.azure.com's password: 

Git似乎没有像以前或其他旧版本的Fedora或Pop那样尊重甚至使用我的主目录中的ssh配置_OS。我不明白它为什么现在这么做,以及如何获得更多信息来弄清楚这一点。

我遇到了完全相同的问题,并在这里找到了解决方案:

Fedora 33位拉取或克隆不再工作和/或ssh密钥不再可识别

基本上,在~/.ssh/config文件的每个Host部分下,添加PubkeyAcceptedKeyTypes ssh-rsa

Host ssh.dev.azure.com
HostName ssh.dev.azure.com
User git
IdentityFile /var/home/filbot/.ssh/id_rsa
IdentitiesOnly yes
PubkeyAcceptedKeyTypes ssh-rsa

使用-v在调试模式下运行ssh。它将输出在后台运行的整个过程。在输出中,它将提到它使用的身份验证方法以及原因。

这似乎是Fedora 33的东西。我使用了Fedora 32工具箱,Git也如预期的那样工作。

➜  ~ toolbox create --release f32
Image required to create toolbox container.
Download registry.fedoraproject.org/f32/fedora-toolbox:32 (500MB)? [y/N]: y
Created container: fedora-toolbox-32
Enter with: toolbox enter --release 32
➜  ~ toolbox enter --release 32
⬢[filbot@toolbox ~]$ git clone -v git@ssh.dev.azure.com:v3/$ORG/$PROJ/Developer.dudleyp.cs_pipeline_tasks
Cloning into 'Developer.dudleyp.cs_pipeline_tasks'...
remote: Azure Repos
remote: Found 45 objects to send. (88 ms)
Receiving objects: 100% (45/45), 77.83 KiB | 25.94 MiB/s, done.
Resolving deltas: 100% (14/14), done.

最新更新