我正在使用 Bitbucket,并且按照此处针对 Linux(Ubuntu 13.04)的说明在 git 上设置了 ssh https://confluence.atlassian.com/pages/viewpage.action?pageId=270827678
但是,当我尝试从我的 Bitbucket 帐户克隆一个任何项目时,我收到一个公钥被拒绝错误
omk@home-pc:/var/www/git$ sudo git clone git@bitbucket.org:MyAccount/MyProject.git
Cloning into 'MyProject'...
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我已将公钥添加到我的 bitbucket 帐户中。
当我尝试“ssh -T git@bitbucket.org”时,终端才会提示我输入我的密码短语,我会得到我的帐户名作为响应。
omk@home-pc:/var/www/git$ ssh -T git@bitbucket.org
logged in as MyUsername.
You can use git or hg to connect to Bitbucket. Shell access is disabled.
我错过了什么吗?
更新:
在 $HOME 克隆工作正常。问题在于必须在 /var/www/git 上使用 sudo。有什么方法可以更改权限以避免使用 sudo?