繁体   English   中英

无法在 Windows 上建立与 Bitbucket 存储库的 ssh 连接

[英]Cannot establish ssh connection to Bitbucket repository on Windows

我在 Windows 10 上生成了 ssh 密钥对,将私钥添加到ssh-add客户端将公钥添加到 Bitbucket。

我运行ssh -T git@bitbucket.org来检查一切是否正常,然后有下一个 output

logged in as myusername
You can use git or hg to connect to Bitbucket. Shell access is disabled

我尝试使用 ssh git clone git@bitbucket.org:myusername/test.git并有身份验证问题

Cloning into 'test'...
Permission denied (publickey).
fatal: Could not read from remote repository.

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

任何想法可能是什么问题? 只有一个想法,在生成 ssh 密钥对时,我将其保存到.ssh文件夹但写入了不同的文件名。 ssh-add -l显示密钥已加载

2048 SHA256:xxxxxxxxxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxx C:\......\.ssh\id_bitbucket_rsa (RSA)

这个答案的帮助下,我发现如果我们使用自定义 ssh 密钥对名称,我们需要将其添加到 git 的 ssh 配置中。

我添加后

AddKeysToAgent yes
IdentityFile ~/.ssh/id_rsa
IdentityFile ~/.ssh/id_bitbucket_rsa 

c:\Program Files\Git\etc\ssh\我可以克隆该存储库。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM