Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git 如何找出推送时使用的公钥bitbucket?_Git_Ssh_Bitbucket - Fatal编程技术网

Git 如何找出推送时使用的公钥bitbucket?

Git 如何找出推送时使用的公钥bitbucket?,git,ssh,bitbucket,Git,Ssh,Bitbucket,我在推送到bitbucket存储库时遇到问题,我收到以下消息: Pushing to ssh://git@bitbucket.org/banana/pera.git Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repositor

我在推送到bitbucket存储库时遇到问题,我收到以下消息:

    Pushing to ssh://git@bitbucket.org/banana/pera.git
    Permission denied (publickey).
    fatal: Could not read from remote repository.

    Please make sure you have the correct access rights
    and the repository exists.
    Pushing to ssh://git@bitbucket.org/banana/pera.git
    Permission denied (publickey).
    fatal: Could not read from remote repository.

    Please make sure you have the correct access rights
    and the repository exists.
    Pushing to ssh://git@bitbucket.org/banana/pera.git
    Permission denied (publickey).
    fatal: Could not read from remote repository.

    Please make sure you have the correct access rights
    and the repository exists.
    Pushing to ssh://git@bitbucket.org/banana/pera.git
    Permission denied (publickey).
    fatal: Could not read from remote repository.

    Please make sure you have the correct access rights
    and the repository exists.
在这里和Atlassian论坛上阅读了一些答案,我发现要测试我的密钥是否正确,我应该使用:
ssh-Thg@bitbucket.org
。我这样做了,我的权限被拒绝了(公钥)。

我现在的问题是要知道它使用哪个文件,这样我就可以给它适当的权限。我该怎么做?
~/.ssh/
下的所有文件都具有700权限。我在用Macbook


感谢您的帮助

最简单的方法是使用
ssh代理

使用
ssh add
ssh add$privatekey
将密钥添加到代理

使用
ssh add-L
打印公钥并检查它是否与bitbucket上的公钥相同


现在尝试
ssh
git clone
,它应该可以工作。

如果您向ssh命令添加
-v
,它应该会显示它试图使用的关键文件。@DanLowe谢谢您。我可以看到命令尝试的文件。该文件已存在。你知道700是正确的许可吗?我在他们的论坛上看到了这一点,但似乎不起作用文件权限不是问题,是远程端在抱怨什么。如果这是一个文件权限问题,您的本地ssh客户端将对此进行投诉,甚至不会尝试连接。密钥文件的模式700或600应该都可以。可能您需要做的只是将您拥有的密钥(现在您已经知道是哪一个)与bitbucket帐户上的密钥进行比较,并确保存在匹配项。谢谢@michas!这就是问题所在,你的回答解决了问题