无法使用ssh连接到visual studio online git repo

问题描述 投票:1回答:2

我创建了一个密钥对

$ ssh-keygen -t rsa -b 4096 -C "[email protected]"

这创建了id_rsa和id_rsa.pub。我将这些复制到我的主目录下的.ssh子目录下。根据我的理解,这会注册私钥,并允许像git这样的应用程序使用它们。然后我到我的visual studio在线项目并使用id_rsa.pub的内容添加了一个SSH公钥。这创造了一个指纹。根据我的理解,这允许具有此ssh令牌的客户端访问我的Git存储库。

接下来我想用它来克隆我的存储库

$ git clone https://xyz.visualstudio.com/_git/myCode
Cloning into 'myCode'...
fatal: Authentication failed for 'https://xyz.visualstudio.com/_git/myCode/'

我需要做些什么才能使git clone命令使用我的ssh密钥?

git ssh azure-devops
2个回答
1
投票

您需要使用SSH端点:单击网页中的克隆>选择SSH选项卡

enter image description here

更多信息,您可以参考这篇文章:Use SSH key authentication


0
投票

由于您使用https作为协议,因此无法享受SSH优势。

我根本不了解visualstudio,但你肯定需要将存储库的远程URL从https://xyz.visualstudio.com/_git/myCode/更改为[email protected]:/_git/myCode/之类的东西

您显然需要服务器接受您的身份并需要在visualstudio.com中的某处设置您的公钥(同样,请不要使用此软件,因此不知道在哪里/如何)

© www.soinside.com 2019 - 2024. All rights reserved.