【发布时间】:2015-09-20 18:59:03
【问题描述】:
当我尝试使用 SSH 克隆托管在 bitbucket 上的公共存储库时,它会失败,例如当我尝试克隆以下 git 存储库时
git clone git@bitbucket.org:tildeslash/monit.git
它给了我这个错误
Cloning into 'monit'...
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
但是,当我尝试使用 HTTPS 克隆相同的存储库时
git clone https://npmtechnologies@bitbucket.org/tildeslash/monit.git
它有效,可能是什么问题?
【问题讨论】:
-
转到您在 bitbucket 上的个人资料设置。检查身份验证(或类似)选项卡下。应该提到在那里添加您的公共 SSH 密钥。
-
公共仓库是否需要 SSH 密钥?它仍然没有意义,因为如果它需要 SSH 密钥,它一定不允许使用 HTTPS 进行克隆,这在我的情况下正在发生。
-
@hjpotter92 你是对的,通过添加 SSH 密钥它确实有效,谢谢 :-)