git 使 IntelliJ IDEA 在 Windows 上使用公钥身份验证

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5518576/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 05:16:26  来源:igfitidea点击:

Make IntelliJ IDEA use public key authentication on Windows

gitsshintellij-ideapublic-key

提问by Vojislav Stojkovic

I'm an Eclipse user who's evaluating a switch to IntelliJ IDEA. I'm currently trying out IDEA 10.0.2. My operating system is Windows.

我是一名 Eclipse 用户,正在评估是否切换到 IntelliJ IDEA。我目前正在试用 IDEA 10.0.2。我的操作系统是 Windows。

When working with Git over SSH, IDEA always asks me for password. I can't find any option in the settings to make it use public key authentication. As per this post, my key is in the %USERPROFILE%\.sshdirectory and my HOMEvariable points to the same directory as USERPROFILE.

通过 SSH 使用 Git 时,IDEA 总是要求我输入密码。我在设置中找不到任何选项以使其使用公钥身份验证。根据这篇文章,我的密钥在%USERPROFILE%\.ssh目录中,我的HOME变量指向与USERPROFILE.

I don't know what I'm doing wrong and Googling for more details hasn't produced any results. Does anyone have any idea how to make IDEA use public key authentication?

我不知道我做错了什么,谷歌搜索更多细节没有产生任何结果。有谁知道如何让 IDEA 使用公钥认证?

EDIT: My key is password-protected.

编辑:我的密钥受密码保护。

回答by CrazyCoder

If your command line git uses public key auth, the same should work from IDEA. In the IDEA VCS settings switch SSH implementation from IDEA sshto nativeso that the same SSH is used as when running command line git.

如果您的命令行 git 使用公钥身份验证,则 IDEA 应该也可以使用。在 IDEA VCS 设置中,将 SSH 实现从 切换IDEA ssh到 ,native以便使用与运行命令行 git 时相同的 SSH。

回答by Junaid

In the latest version [as of April 29th, 2019], there is no option for SSH executableto switch SSH implementation. So, I followed the following steps on Windows 10:

在最新版本中 [截至 2019 年 4 月 29 日],没有SSH executable切换 SSH 实现的选项。因此,我在 Windows 10 上遵循以下步骤:

  1. Create an ssh-keypair (it can be created on Linux and copied onto windows machine)
  2. Copy public SSH key contents to GitHub Settings-> SSH and GPG keys-> New SSH key
  3. Copy private key to C:\Users\<your-user-name>\.ssh\
  1. 创建一个 ssh-keypair(它可以在 Linux 上创建并复制到 Windows 机器上)
  2. 将公共 SSH 密钥内容复制到 GitHub Settings-> SSH and GPG keys->New SSH key
  3. 将私钥复制到 C:\Users\<your-user-name>\.ssh\