gpt4 book ai didi

bash - Git 不使用 SSH key 对 Azure DevOps 进行身份验证

转载 作者:行者123 更新时间:2023-12-02 07:34:54 25 4
gpt4 key购买 nike

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

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 <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="deb9b7aa9eadadb6f0babba8f0bfa4abacbbf0bdb1b3" rel="noreferrer noopener nofollow">[email protected]</a>:v3/$ORG/$PROJ/Developer.dudleyp.cs_pipeline_tasks
Cloning into 'Developer.dudleyp.cs_pipeline_tasks'...
<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="22454b566251514a0c4647540c43585750470c414d4f" rel="noreferrer noopener nofollow">[email protected]</a>'s password:

⬢[filbot@toolbox ~]$ GIT_SSH_COMMAND=ssh git clone <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7a1d130e3a090912541e1f0c541b000f081f54191517" rel="noreferrer noopener nofollow">[email protected]</a>:v3/$ORG/$PROJ/Developer.dudleyp.cs_pipeline_tasks
Cloning into 'Developer.dudleyp.cs_pipeline_tasks'...
<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8bece2ffcbf8f8e3a5efeefda5eaf1fef9eea5e8e4e6" rel="noreferrer noopener nofollow">[email protected]</a>'s password:

⬢[filbot@toolbox ~]$ ssh -T <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="bddad4c9fdceced593d9d8cb93dcc7c8cfd893ded2d0" rel="noreferrer noopener nofollow">[email protected]</a>
Warning: Permanently added the RSA host key for IP address '20.37.158.9' to the list of known hosts.
<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f5929c81b586869ddb919083db948f808790db969a98" rel="noreferrer noopener nofollow">[email protected]</a>'s password:

⬢[filbot@toolbox ~]$ ssh -i ~/.ssh/id_rsa -T <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="96f1ffe2d6e5e5feb8f2f3e0b8f7ece3e4f3b8f5f9fb" rel="noreferrer noopener nofollow">[email protected]</a>
<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c2a5abb682b1b1aaeca6a7b4eca3b8b7b0a7eca1adaf" rel="noreferrer noopener nofollow">[email protected]</a>'s password:

Git 似乎没有像以前或在 Fedora 或 Pop!_OS 的其他旧安装中那样尊重甚至使用我的主目录中的 ssh 配置。我不明白为什么现在要这样做,以及如何获取信息以进一步了解这一点。

最佳答案

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

Fedora 33 git pull or clone no longer working and/or ssh key no longer recognized

基本上,在 ~/.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

关于bash - Git 不使用 SSH key 对 Azure DevOps 进行身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64795236/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com