From 3f38ba5ad75539203ab03da0c171f37d632d640d Mon Sep 17 00:00:00 2001 From: Jeff Yates Date: Thu, 23 Feb 2017 15:44:00 -0600 Subject: [PATCH] Don't rerun pageant if there are no keys to add Currently, if there is no key file, posh-git's Start-SshAgent runs pageant twice which causes pageant to show an error dialog about already running. This simple change stops that happening. --- src/GitUtils.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/GitUtils.ps1 b/src/GitUtils.ps1 index 0dffea0c8..6138c7257 100644 --- a/src/GitUtils.ps1 +++ b/src/GitUtils.ps1 @@ -529,7 +529,9 @@ function Add-SshKey() { if ($args.Count -eq 0) { $keyPath = Join-Path $Env:HOME .ssh $keys = Get-ChildItem $keyPath/*.ppk -ErrorAction SilentlyContinue | Select-Object -ExpandProperty FullName - & $pageant $keys + if ($keys) { + & $pageant $keys + } } else { foreach ($value in $args) {