无法与 Windows 上的 Bitbucket 存储库建立 ssh 连接
Cannot establish ssh connection to Bitbucket repository on Windows
我在 Windows 10 上生成了 ssh 密钥对 ssh-add
客户端添加了 public 密钥到 Bitbucket。
我运行ssh -T git@bitbucket.org
检查一切正常并有下一个输出
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)
在 this answer 的帮助下,我发现如果我们使用自定义 ssh 密钥对名称,我们需要将其添加到 git 的 ssh 配置中。
我添加后
AddKeysToAgent yes
IdentityFile ~/.ssh/id_rsa
IdentityFile ~/.ssh/id_bitbucket_rsa
到 c:\Program Files\Git\etc\ssh\
我可以克隆那个存储库。
我在 Windows 10 上生成了 ssh 密钥对 ssh-add
客户端添加了 public 密钥到 Bitbucket。
我运行ssh -T git@bitbucket.org
检查一切正常并有下一个输出
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)
在 this answer 的帮助下,我发现如果我们使用自定义 ssh 密钥对名称,我们需要将其添加到 git 的 ssh 配置中。
我添加后
AddKeysToAgent yes
IdentityFile ~/.ssh/id_rsa
IdentityFile ~/.ssh/id_bitbucket_rsa
到 c:\Program Files\Git\etc\ssh\
我可以克隆那个存储库。