git SmartGit 不会使用 ssh 进行身份验证

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8788813/
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-10 12:41:40  来源:igfitidea点击:

SmartGit won't authenticate with ssh

gitsshsmartgit

提问by dazz

I have a webserver with gitolite installed and where i login using my ssh key. Normally i just use git on the server itself using the command line but for a new project i need to clone a repo on my windows pc and i would like to use SmartGit for this.

我有一个安装了 gitolite 的网络服务器,我使用我的 ssh 密钥登录。通常我只是使用命令行在服务器本身上使用 git 但对于一个新项目,我需要在我的 Windows pc 上克隆一个 repo,我想为此使用 SmartGit。

But i've spend several hours already just to clone the repo via Smartgit. As remote Git i use the url i normally would use on the server: me@my-server:the-repo then after a while i get a dialogue box 'SSH Authentication' and i select my private key, as i would do for pagent, and put in my Passphrase. But when i click login it just tries to connect for a while and then shows me the 'SSH Authentication' dialogue box again. No error message or anything.

但是我已经花了几个小时来通过 Smartgit 克隆 repo。作为远程 Git,我使用我通常会在服务器上使用的 url:me@my-server:the-repo 然后过了一会儿,我得到一个对话框“SSH 身份验证”,然后我选择了我的私钥,就像我对 pagent 所做的一样,并输入我的密码。但是当我单击登录时,它只是尝试连接一段时间,然后再次向我显示“SSH 身份验证”对话框。没有错误信息或任何东西。

I tried the clone the repo with the same data via command line and that works just fine. So is there something i'm missing?

我尝试通过命令行使用相同的数据克隆 repo,效果很好。那么有什么我想念的吗?

回答by dazz

Needed to save my ssh private key as an OpenSSH key in PuTTYgenbecause SmartGit only understand that format.

需要将我的 ssh 私钥保存为PuTTYgen 中的 OpenSSH 密钥,因为 SmartGit 只理解该格式。

回答by mmmx

Yes, that's it!

对,就是那样!

I just want to go in details to help the ones starting from scratch:

我只想详细帮助那些从头开始的人:

on windows you can do the following procedure:

在 Windows 上,您可以执行以下步骤:

  1. Install msysgit from Here
  2. To generate public/private key pair as needed by many git servers (like Assembla) use PuTTYgenthat you find here: click on Generateand move your mouseuntil it tells you that the key is generated. Optionally, enter a passphrase to protect your private key
  3. Save or copy the public key at your need
  4. Save private key to use with SmartGit using menu voice Conversions/Export OpenSSH key
  5. Use the last file to authenticate in SmartGit
  1. 这里安装 msysgit
  2. 要根据许多 git 服务器(如 Assembla)的需要生成公钥/私钥对,请使用 您在此处找到的PuTTYgen:单击“生成”移动鼠标,直到它告诉您密钥已生成。(可选)输入密码以保护您的私钥
  3. 根据需要保存或复制公钥
  4. 使用菜单语音转换/导出 OpenSSH 密钥保存私钥以与 SmartGit 一起使用
  5. 使用最后一个文件在 SmartGit 中进行身份验证

回答by new2cpp

If you want to use putty as ssh client, please follow the below steps:

如果您想使用 putty 作为 ssh 客户端,请按照以下步骤操作:

  1. Edit|Preferences|Commands|Authentication, choose Use System SSH Client
  2. In windows system variables, set GIT_SSH=plink (where putty's plink.exe location)
  1. 编辑|首选项|命令|身份验证,选择 Use System SSH Client
  2. 在windows系统变量中,设置GIT_SSH=plink(putty的plink.exe所在位置)

After that, please use pageantand load the private key

之后,请使用pageant并加载私钥

回答by rjwirth

I found it easier to change SmartGit | Preference | Commands | Executables to use "C:\Program Files (x86)\Git\bin\git.exe", and then set GIT_SSH=plink in the system env.

我发现更改 SmartGit 更容易 | 偏好 | 命令 | 可执行文件使用“C:\Program Files (x86)\Git\bin\git.exe”,然后在系统env中设置GIT_SSH=plink。

回答by Mr-IDE

If you're using SmartGit on MacOS X, this problem causes an unexpected dialog to be displayed in the Finder:

如果您在 MacOS X 上使用 SmartGit,此问题会导致 Finder 中显示意外对话框:

"SSH - Enter passphrase for key '/Users/username/.ssh/id_rsa':"

"SSH - Enter passphrase for key '/Users/username/.ssh/id_rsa':"

And it pops up when SmartGit is launched. It looks like this:

当 SmartGit 启动时它会弹出。它看起来像这样:

SmartGit SSH passphrase prompt

SmartGit SSH 密码提示

It's odd and confusing how looks like a Finder dialog, with no reference at all to SmartGit. It's usually caused by the SSH key password not being stored in the Keychain Access app. That's where SmartGit will look for it. You'll need to add it in there, like this:

Finder 对话框的外观很奇怪且令人困惑,完全没有提及 SmartGit。这通常是由于 SSH 密钥密码未存储在 Keychain Access 应用程序中造成的。这就是 SmartGit 将寻找它的地方。你需要在那里添加它,像这样:

ssh-add -K ~/.ssh/id_rsa    (assuming id_rsa is your private key file)

The above command is sometimes needed after restarting your computer. See also these guides:

重新启动计算机后有时需要上述命令。另请参阅这些指南: