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

时间:2017-01-19 21:03:00

标签: 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 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 -T hg@bitbucket.org。我做了,我得到了Permission denied (publickey).

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

感谢您的帮助

1 个答案:

答案 0 :(得分:1)

最简单的方法是使用ssh-agent

使用ssh-addssh-add $privatekey将您的密钥添加到代理商。

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

现在尝试sshgit clone,它应该有用。