git - Intellij IDEA - git ssh - 权限被拒绝(公钥)

标签 git intellij-idea ssh bitbucket

我无法从 Intellij IDEA 克隆存储库并且失败并出现以下错误,如图所示。

但是,我能够从命令提示符成功克隆存储库,如下图所示。

请注意,我已成功将公钥文件添加到 Bitbucket。此外,下图还显示了“config”文件的内容。

enter image description here

正如评论中所建议的,我已经运行了 which git 命令,它指向位置 /usr/local/bin/git ,如下图所示:

enter image description here

此外,IntelliJ 的“版本控制”> Git 设置也指向相同的位置,即 /usr/local/bin/git,如下图所示:

enter image description here

我还在下图中提供了 Intellij 控制台选项卡错误详细信息:

enter image description here

最佳答案

我最近在使用 SSH 作为身份验证方法时遇到了完全相同的问题。 我的解决方案是在 ~/.ssh 中创建一个 config 文件(或者修改它,如果你已经有一个)。

在此 config 文件中添加:

Host github.com
  User git
  IdentityFile ~/.ssh/name_of_your_private_key

然后chmod 600config文件。

当然,您可以根据任何特定情况将HostUser 替换为值。

希望这有帮助;)

关于git - Intellij IDEA - git ssh - 权限被拒绝(公钥),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69121559/

相关文章:

bash - 如何转义 ssh/remote bash 命令中的单引号字符?

git - 如何在 Azure DevOps 中删除 merge 的功能分支?

ruby-on-rails - 如何在 Rails 环境中的 RubyMine 或 IDEA 中运行 scratch 文件?

java - 构建项目时“解析 java...”卡在 IntelliJ 中

linux - 服务器命令行自动化(更新项目)

docker - JetBrains 空间。 docker-compose 与 -H 标志部署在远程服务器上

git - 'git push heroku master' 仍在请求身份验证

node.js - AWS Elastic Beanstalk : Do I have to deploy my app with full "/node_modules" and "/bower_components" and compiled sass and other dependencies?

git - GitHub 中 HTTPS 和 SSH 的混淆

java - 什么是 IntelliJ 代码检查中的入口点,我需要将它们设置为 "fix"吗?