一个很可能相关的信息是,我已经为bitbucket设置了自定义ssh配置。在我的'.ssh/config'文件中,我有以下内容:
[ivanna@comp]$ cat ~/.ssh/config
Host bitbucket
Hostname bitbucket.org
IdentityFile /home/ivanna/.ssh/id_rsa_bitbucket
IdentitiesOnly yes
就ssh而言,此文件的权限肯定是正确的(我在配置文件中积极使用其他条目)。现在,当我在git中添加远程源时,我使用的是bitbucket而不是bitbucket.org:
git remote add origin bitbucket:ivanna/my-repo.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/pages/viewpage.action?pageId=302811860)。当我按照他们说的检查密钥时:
[ivanna@comp]$ ssh -T hg@bitbucket
logged in as ivanna.
You can use git or hg to connect to Bitbucket. Shell access is disabled.
它似乎可以成功登录。那么为什么推送不起作用呢?上面的链接提到可能是项目本身的权限问题,但我按照建议设置了权限却没有任何作用。有人知道发生了什么吗?