【问题标题】:Clone repo from BitBucket over SSH in Git GUI在 Git GUI 中通过 SSH 从 BitBucket 克隆 repo
【发布时间】:2019-10-01 09:25:28
【问题描述】:

我在 BitBucket 上有一个存储库,我正在尝试使用 Git GUI 通过 SSH 连接到它并将存储库克隆到我的本地文件夹。我已将公钥(在 Git 中生成)添加到 BitBucket 帐户(在设置 -> SSH 密钥中)。

我从 BitBucket 复制克隆命令(存储库的源页面中的“克隆此存储库”选项)并将其粘贴到 Git GUI。克隆命令:

git clone git@bitbucket.org:mycode/myserver.git

然后我按下“克隆”按钮并收到此错误:

git clone git@bitbucket.org: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

还有什么我在这里忘记了它不起作用?

【问题讨论】:

  • 你添加私钥了吗?您可以通过git clone -v git@bitbucket.org:mycode/myserver.git 获得更多信息。也许这会有所帮助
  • 在哪里添加私钥?
  • 我在 Git 的安装文件夹中使用了 start-ssh-agent.cmd 命令。它在我的本地文件夹 C:\Users\username\.ssh\ 中生成了文件:id_rsa 和 id_rsa.pub。我认为 id_rsa 是私钥,Git 应该知道在那个位置找到它。
  • 此命令只生成了两个密钥,但您的 ssh 代理不知道它们的存在。你可以关注这个话题:stackoverflow.com/questions/18683092/…

标签: git ssh bitbucket


【解决方案1】:

好的,所以我在 Git 的 bash 中配置了我的用户帐户,然后输入了 clone 命令,它工作了。

配置用户:

$ git config --global user.name myusername
$ git config --global user.email myemail@email.com

然后repo克隆

$ git clone git@bitbucket.org:mycode/myserver.git LocalRelativeFolderName

【讨论】:

    猜你喜欢
    • 2020-03-20
    • 2013-08-07
    • 1970-01-01
    • 2014-03-06
    • 1970-01-01
    • 1970-01-01
    • 2018-08-24
    • 1970-01-01
    相关资源
    最近更新 更多