【问题标题】:Issue git clonning using ssh but works using https使用 ssh 发出 git 克隆,但使用 https 工作
【发布时间】: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 密钥它确实有效,谢谢 :-)

标签: git ssh git-clone


【解决方案1】:

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

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

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

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

【讨论】:

  • 点对点,我只是碰巧再次测试它并通过添加 SSH 密钥,它确实有效。谢谢。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-09-14
  • 1970-01-01
  • 2017-08-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-03-20
相关资源
最近更新 更多