使用ssh发出git clonning但使用https工作

时间:2015-09-20 10:45:40

标签: git ssh git-clone

当我尝试使用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克隆相同的repo时

git clone https://npmtechnologies@bitbucket.org/tildeslash/monit.git

它有效,可能是什么问题?

1 个答案:

答案 0 :(得分:1)

https和ssh是两种不同的协议。

您的 public key might not be properly registered in your Bitbucket account 与https网址无关,这将起作用。

  

如果需要SSH密钥,则不得允许使用HTTPS进行克隆

否:每个公共回购都可以通过ssh或https访问。一个不比另一个更“强制” 如果ssh不起作用,https会 Https仅在推送时才需要密码 ssh要求您的公钥在Bitbucket帐户中注册,以建立经过身份验证的连接。