【发布时间】: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/…