配置 Git 以使用 Plink

发布于 2024-09-04 09:52:47 字数 201 浏览 12 评论 0原文

我正在尝试配置 Git 以使用 Plink。它以前对我有用过很多次。现在,由于某种原因,此选项对我不可用(已禁用):

Git Setup Plink option Screenshot

I尝试卸载并重新安装 Git 一百次。没有什么。我无法启用此选项。

I'm trying to configure Git to use Plink. It worked for me many times before. Now, for some reason, this option isn't available to me (it is disabled):

Git Setup Plink option screenshot

I tried uninstalling and reinstalling Git a hundred times. Nothing. I can't get to this option enabled.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

疯狂的代价 2024-09-11 09:52:47

我刚刚遇到了这个问题(使用较新版本的 Git,1.7.9)。我使用了 VonC 的答案,但只需要几个步骤:

  1. 将环境变量 GIT_SSH 设置为 plink.exe 的位置
  2. 运行 pageant.exe< /code> 并加载您的私钥

在 64 位 Windows 上,plink 的默认位置是 C:\Program Files (x86)\GitExtensions\PuTTY\plink.exe
路径中的空格似乎不再是问题。

I just had this problem (with a newer version of Git, 1.7.9). I used the answer from VonC, but only a couple of steps were needed:

  1. Set the environment variable GIT_SSH to the location of plink.exe
  2. Run pageant.exe and load your private key

On 64 bit Windows, the default location for plink is C:\Program Files (x86)\GitExtensions\PuTTY\plink.exe
The spaces in the path no longer seem to be a problem.

老旧海报 2024-09-11 09:52:47

这是一个老问题,我也有同样的问题,只是为了确保我会写下对我有用的解决方案。

  • msysgit 安装程序没有显示允许在 openssh 客户端和 Tortoise 之间进行选择的屏幕 (plink)

  • 解决方案是安装 Putty(或者我猜是 Tortoise Plink),创建并保存至少一个会话,仅安装 Putty 不起作用,必须创建会话,安装程序会对此进行一些奇怪的检查.

  • 当您再次运行 Git 安装程序时,应该会出现该屏幕。

在此处输入图像描述

This is an old question, and I just have the same problem, just to be sure I will write down the solution that worked for me.

  • The msysgit installer didn't show the screen that allows to select between the openssh client and the Tortoise (plink)

  • The solution is to install Putty (or Tortoise Plink I guess), create and save at least one session, just installing Putty didn't work, the session must be created, the installer does some weird check about that.

  • When you run the Git installer again, the screen should appear.

enter image description here

薆情海 2024-09-11 09:52:47

这看起来像问题 368

当我更新安装时,从未询问我是否要使用 PLink。
现在,Git 继续寻找 OpenSSH 密钥。 Git 找不到我的 putty 密钥。

我尝试加载我的 putty 私钥并重新安装 Git。无论我做什么,我都无法让 Git 使用我的 putty plink 数据和私钥。

有一个解决方法(问题 367

  1. 确保 plink 位于 PATH
  2. 保存一个 Putty 会话的设置(无论是哪一个)

并在安装 git 之前执行这些操作。


即使有了这个过程,也不容易:

我终于能够让 GIT 与 Plink 一起工作。

一条评论:
我在安装 GIT 之前确实启动了 Plink 会话。即使 Plink 会话正在运行,我也无法让安装程序识别出 Plink 正在运行。

我的解决办法:

  1. 我终于安装了 GIT 1.6.5.1。
  2. 更改了 Plink 路径以删除空格。我将目录更改为:
    c:\program files\puttyc:\putty
  3. 将环境变量GIT_SSH设置为新路径。 c:\putty\plink.exe.

通过这些更改,GIT 现在可以正常运行。

关于空格,如 user2428118评论,您可以使用 8.3 路径:那里不需要空间:

set GIT_SSH=C:\PROGRA~1\PuTTY\plink.exe

Janusz Skonieczny 添加在评论中

要设置此功能,请以管理员身份快速运行 PowerShell:

[环境]::SetEnvironmentVariable("GIT_SSH", "D:\your_path_here\plink.exe", "User")

2017 年 3 月更新,对于 Git 2.13(2017 年第 2 季度)

Git 现在会自动检测您需要的 ssh(OpenSSH 或 plink),但您可以使用 ss.variant.

请参阅提交 dd33e07(2017 年 2 月 1 日)和 提交 e9d9a8a(2017 年 1 月 2 日),作者:Segev Finer (segevfiner)
请参阅 提交 e2824e4(2017 年 2 月 1 日),作者:Johannes Schindelin (dscho)
请参阅 提交 6a4f3a9(2017 年 1 月 26 日),作者:Junio C Hamano (gitster)
(由 Junio C Hamano -- gitster -- 合并于 提交 be6ab59,2017 年 2 月 27 日)

ssh.variant:

根据环境变量 GIT_SSHGIT_SSH_COMMAND 的值,或配置设置 core.sshCommand,Git 自动检测是否调整其命令行参数以与 plinktortoiseplink 一起使用,而不是默认值 (OpenSSH)。

可以设置配置变量ssh.variant来覆盖此自动检测;
有效值为 sshplinkputtytortoiseplink
任何其他值都将被视为普通 ssh。
可以通过环境变量GIT_SSH_VARIANT覆盖此设置。

This looks like issue 368:

When I updated the install never asked if I wanted to use PLink.
Now, Git continues to look for an OpenSSH key. Git could not find my putty key.

I have tried loading my putty private key and reinstalling Git. No matter what I do I can't get Git to use my putty plink data and private key.

This has a workaround (issue 367)

  1. making sure that plink is in PATH
  2. Saving settings for one putty session (doesn't matter which one)

and by doing those before installing git.


Even with that process, it is not easy:

I was finally able to get GIT to work with Plink.

One comment:
I did start a Plink session before installing GIT. Even with a Plink session running, I am never able to get the installer to recognize Plink was running.

My work around:

  1. I finally just installed GIT 1.6.5.1.
  2. I changed the Plink path to removes spaces. I changed the directory from:
    c:\program files\putty to c:\putty.
  3. I set the environment variable GIT_SSH to the new path. c:\putty\plink.exe.

With these changes GIT is now functioning properly.

Regarding spaces, as noted by user2428118 in the comments, you can use an 8.3 path: no space needed there:

set GIT_SSH=C:\PROGRA~1\PuTTY\plink.exe

Janusz Skonieczny adds in the comments:

To setup this quickly run PowerShell as admin:

[Environment]::SetEnvironmentVariable("GIT_SSH", "D:\your_path_here\plink.exe", "User")

Update March 2017, for Git 2.13 (Q2 2017)

Git now auto-detects the ssh you need (OpenSSH or plink), but you can force that detection with ss.variant.

See commit dd33e07 (01 Feb 2017), and commit e9d9a8a (02 Jan 2017) by Segev Finer (segevfiner).
See commit e2824e4 (01 Feb 2017) by Johannes Schindelin (dscho).
See commit 6a4f3a9 (26 Jan 2017) by Junio C Hamano (gitster).
(Merged by Junio C Hamano -- gitster -- in commit be6ab59, 27 Feb 2017)

ssh.variant:

Depending on the value of the environment variables GIT_SSH or GIT_SSH_COMMAND, or the config setting core.sshCommand, Git auto-detects whether to adjust its command-line parameters for use with plink or tortoiseplink, as opposed to the default (OpenSSH).

The config variable ssh.variant can be set to override this auto-detection;
Valid values are ssh, plink, putty or tortoiseplink.
Any other value will be treated as normal ssh.
This setting can be overridden via the environment variable GIT_SSH_VARIANT.

血之狂魔 2024-09-11 09:52:47

如果您使用TortoiseGit,您可以永久配置其plink。当然,请在您的计算机上使用正确的路径。

setx GIT_SSH "C:\Program Files\TortoiseGit\bin\TortoiseGitPlink.exe"

If you are using TortoiseGit, you can permanently configure its plink. Of course use correct path on your machine.

setx GIT_SSH "C:\Program Files\TortoiseGit\bin\TortoiseGitPlink.exe"
不疑不惑不回忆 2024-09-11 09:52:47

我多年来一直使用带有 GIT_SSH 环境变量的解决方案,但今年的某个时候它停止工作(在更新 git bash 或 putty 工具包之后)。我找到了当前的工作灵魂。首先,您的选美比赛必须正在进行。其次,您必须启动 ssh 代理,但 Windows 代理:

eval `ssh-pageant`

它相当于 Windows 用户所知道的:

eval `ssh-agent`

要添加密钥,您可以使用 ssh-add 或 Pagenant UI 窗口。

I used for many years the solution with GIT_SSH environment variable, but sometime this year it stopped working (after update of git bash or putty toolkit). I've found current working soultion. First, your pageant must be running. Second you must start ssh agent, but the windows one:

eval `ssh-pageant`

It is windows equivalent of what unix users know:

eval `ssh-agent`

To add keys you can use ssh-add or Pagenant UI window.

墨落成白 2024-09-11 09:52:47

这就是我于 2023 年 1 月在我的计算机 (Windows 10 Pro x64) 上修复它的方法。1

& 2)配置TortoiseGit(在其设置中...网络>> SSH>> SSH客户端)和Git(GIT_SSH环境变量)以同时使用
    C:\Program Files\PuTTY\plink.exe
不带引号。

3& 4) 将 Pageant 和 ssh-add 代理设置为自动启动(我使用了 ssh 代理脚本
https:// docs.github.com/en/authentication/connecting-to-github-with-ssh/working-with-ssh-key-passphrases
并使用我的私钥。

This is what I did to fix it on my machine (Windows 10 Pro x64) in January 2023.

1 & 2) Configured TortoiseGit (in its settings... Network >> SSH >> SSH client) and Git (the GIT_SSH environment variable) to both use
    C:\Program Files\PuTTY\plink.exe
without quotation marks.

3 & 4) Set up both Pageant and ssh-add agent to auto-start (I used the ssh agent script from
https://docs.github.com/en/authentication/connecting-to-github-with-ssh/working-with-ssh-key-passphrases
and use my private key.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文