无法使用 SSH 密钥连接到 bitbucket,但可以通过 SourceTree 连接
Not able to connect to bitbucket using SSH keys, but connecting through SourceTree is working
我已经使用 PuttyGen 生成了 SSH 密钥(私有密钥在 .ssh 文件夹下保存为 "private.ppk")。我已将 public 密钥添加到我的组织 Bitbucket 的 SSH 密钥部分。如果我尝试使用 SourceTree 执行任何 git 操作,它工作正常。但是如果我尝试从 GitBash 或 IntelliJ Idea 做任何事情,它会给出以下错误
git@bitbucket.companyname: Permission denied (publickey). fatal: Could
not read from remote repository.
Please make sure you have the correct access rights and the repository
exists.
生成密钥时使用了 "SSH-2 RSA key" 选项。
这意味着您的 GIT_SSH
environment variable does not reference plink.exe
(这里假设 Windows)。
但另一种方法是使用 openSSH 而不是 putty 生成 SSH 密钥(起初没有用于测试的密码):
ssh-keygen -t rsa -P"" -m PEM
这将生成默认的 %USERPROFILE%/.ssh/id_rsa(.pub)
private/public 密钥
注册您帐户的 public 密钥,然后重试。
然后确保 SourceTree 是 configured to reference OpenSSH,而不是 PuTTY。
我已经使用 PuttyGen 生成了 SSH 密钥(私有密钥在 .ssh 文件夹下保存为 "private.ppk")。我已将 public 密钥添加到我的组织 Bitbucket 的 SSH 密钥部分。如果我尝试使用 SourceTree 执行任何 git 操作,它工作正常。但是如果我尝试从 GitBash 或 IntelliJ Idea 做任何事情,它会给出以下错误
git@bitbucket.companyname: Permission denied (publickey). fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
生成密钥时使用了 "SSH-2 RSA key" 选项。
这意味着您的 GIT_SSH
environment variable does not reference plink.exe
(这里假设 Windows)。
但另一种方法是使用 openSSH 而不是 putty 生成 SSH 密钥(起初没有用于测试的密码):
ssh-keygen -t rsa -P"" -m PEM
这将生成默认的 %USERPROFILE%/.ssh/id_rsa(.pub)
private/public 密钥
注册您帐户的 public 密钥,然后重试。
然后确保 SourceTree 是 configured to reference OpenSSH,而不是 PuTTY。