mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
fix: SSH_ASKPASS can NOT use parameter
This commit is contained in:
parent
7febac5843
commit
ca461d1926
3 changed files with 4 additions and 3 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -604,3 +604,4 @@ build/*.zip
|
||||||
build/*.tar.gz
|
build/*.tar.gz
|
||||||
build/*.deb
|
build/*.deb
|
||||||
build/*.rpm
|
build/*.rpm
|
||||||
|
build/*.AppImage
|
||||||
|
|
|
@ -456,10 +456,10 @@ namespace SourceGit
|
||||||
private bool TryLaunchedAsAskpass(IClassicDesktopStyleApplicationLifetime desktop)
|
private bool TryLaunchedAsAskpass(IClassicDesktopStyleApplicationLifetime desktop)
|
||||||
{
|
{
|
||||||
var args = desktop.Args;
|
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;
|
return false;
|
||||||
|
|
||||||
desktop.MainWindow = new Views.Askpass(args[1]);
|
desktop.MainWindow = new Views.Askpass(args[0]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace SourceGit.Commands
|
||||||
// Force using this app as SSH askpass program
|
// Force using this app as SSH askpass program
|
||||||
var selfExecFile = Process.GetCurrentProcess().MainModule.FileName;
|
var selfExecFile = Process.GetCurrentProcess().MainModule.FileName;
|
||||||
start.Environment.Add("DISPLAY", "required");
|
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");
|
start.Environment.Add("SSH_ASKPASS_REQUIRE", "prefer");
|
||||||
|
|
||||||
// If an SSH private key was provided, sets the environment.
|
// If an SSH private key was provided, sets the environment.
|
||||||
|
|
Loading…
Reference in a new issue