From ca461d1926702ed575ca336555f6151dcf845ddd Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 10 Jul 2024 10:47:43 +0800 Subject: [PATCH] fix: SSH_ASKPASS can NOT use parameter --- .gitignore | 1 + src/App.axaml.cs | 4 ++-- src/Commands/Command.cs | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index ed1d7c43..0b5677c5 100644 --- a/.gitignore +++ b/.gitignore @@ -604,3 +604,4 @@ build/*.zip build/*.tar.gz build/*.deb build/*.rpm +build/*.AppImage diff --git a/src/App.axaml.cs b/src/App.axaml.cs index 1b623334..d3f9203d 100644 --- a/src/App.axaml.cs +++ b/src/App.axaml.cs @@ -456,10 +456,10 @@ namespace SourceGit private bool TryLaunchedAsAskpass(IClassicDesktopStyleApplicationLifetime desktop) { var args = desktop.Args; - if (args.Length <= 1 || !args[0].Equals("--askpass", StringComparison.Ordinal)) + if (args.Length != 1 || !args[0].StartsWith("Enter passphrase", StringComparison.Ordinal)) return false; - desktop.MainWindow = new Views.Askpass(args[1]); + desktop.MainWindow = new Views.Askpass(args[0]); return true; } diff --git a/src/Commands/Command.cs b/src/Commands/Command.cs index 1cd499d0..c3676f16 100644 --- a/src/Commands/Command.cs +++ b/src/Commands/Command.cs @@ -53,7 +53,7 @@ namespace SourceGit.Commands // Force using this app as SSH askpass program var selfExecFile = Process.GetCurrentProcess().MainModule.FileName; start.Environment.Add("DISPLAY", "required"); - start.Environment.Add("SSH_ASKPASS", $"\"{selfExecFile}\" --askpass"); + start.Environment.Add("SSH_ASKPASS", selfExecFile); // Can not use parameter here, because it invoked by SSH with `exec` start.Environment.Add("SSH_ASKPASS_REQUIRE", "prefer"); // If an SSH private key was provided, sets the environment.