Git Clone:权限被拒绝(publickey)。致命:无法从远程存储库读取

时间:2016-07-06 10:00:07

标签: git bitbucket

我正在使用bitbucket而我正在尝试使用以下代码克隆回购:sudo git clone git@bitbucket.org:KassaK/mbf.git

我收到此错误:

Permission denied (publickey).
fatal: Could not read from remote repository.

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

我到处寻找解决方案但没有任何好处。

我从https://confluence.atlassian.com/bitbucket/set-up-ssh-for-git-728138079.html(到步骤)获得了说明,但我总是有这个错误。

我尝试删除并重新安装git,但它是一样的。

对我有什么想法?谢谢 !

1 个答案:

答案 0 :(得分:2)

对于公钥认证系统,它涉及主机名,用户名,密钥文件名等,如果你用sudo运行,用户名将是 root ,它与你的不一样运行ssh-keygen来创建密钥对。 因此身份验证失败。