Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NBug] SSH key file could not be found #10650

Closed
FPA-DavidTai opened this issue Jan 16, 2023 · 14 comments
Closed

[NBug] SSH key file could not be found #10650

FPA-DavidTai opened this issue Jan 16, 2023 · 14 comments

Comments

@FPA-DavidTai
Copy link

Environment

  • Git Extensions 4.0.1.15887
  • Build f2567de
  • Git 2.38.1.windows.1
  • Microsoft Windows NT 10.0.19043.0
  • .NET 6.0.13
  • DPI 96dpi (no scaling)

Issue description

''

GitUI.NBugReports.UserExternalOperationException: SSH key file could not be found
 ---> System.IO.FileNotFoundException: SSH key file could not be found
   --- End of inner exception stack trace ---
   at GitUI.Infrastructure.PuttyHelpers.ThrowIfFileNotFound(String filePath, String errorMessage, String heading)
   at GitUI.Infrastructure.PuttyHelpers.StartPageantIfConfigured(Func`1 sshKeyFileLoader)
   at GitUI.CommandsDialogs.FormPush.StartPageant(String remote)
   at GitUI.CommandsDialogs.FormPush.PushChanges(IWin32Window owner)
   at GitUI.CommandsDialogs.FormPush.PushClick(Object sender, EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, WM msg, IntPtr wparam, IntPtr lparam)

After rebase, trying to force push with lease like what I used to do in previous version.

Steps to reproduce

image

Trying to push a local branch to origin but this error pops up.

image

Did this work in previous version of GitExtensions?

Yes

Diagnostics

No response

@duplicates-detector-bot
Copy link

Potential duplicates:

  • #8089
  • #8187
  • #8966
  • #9920
  • #10363
  • #10367
  • #10368
  • #10381
  • #10412
  • #10413
  • #10528
  • #10530
  • #10551
  • #10555
  • #10562
  • #10565
  • #10569
  • #10596
  • #10609
  • #10623
  • #10625
  • #10627
  • #10628
  • #10631

@RussKie
Copy link
Member

RussKie commented Jan 16, 2023 via email

@pazoozooCH
Copy link

Can it be that with the new version (not sure if it's 4.0.2 or 4.x in general), Git Extension always tries to start the Pagent, even though it's already running and I don't have "Automatically start authentication client when a private key is configured for a remote" checked (nor do I have a private key configured)?

It's not really breaking anything, but it's a bit annoying to get a "Pageant is already running" dialog I need to click away on every push operation...

@RussKie
Copy link
Member

RussKie commented Jan 16, 2023 via email

@pazoozooCH
Copy link

4.0.2.16100
I never had this with 3.x. With 4.0.1.x, I also had the File not found issue mentioned in this issue, so I never got to the point that Git extensions wanted to do something with the agent...
On my other machine, I think I already installed 4.0.0 (don't have the exact version right now) and didn't experience this issue either. I always have the Pageant running with Keepass/Keeagent plugin.

@pazoozooCH
Copy link

pazoozooCH commented Jan 17, 2023

I also tested this on my other machine and can confirm:

  • Version 4.0.0.15569: everything worked smoothly
  • Version 4.0.1.x: Problem with SSH authentication, as described in this and other issues
  • Version 4.0.2.16100: SSH works again, but GitExtensions always seems to try to start pageant when I push something. No problem on pull. The push will succeed, so it's not a blocking problem, but it's still annoying to always get an error dialog on each push...

I am using Putty and already have a pageant running when I start / use GitExtensions. There are no keys configured in GitExtensions and the option "Automatically start authentication client..." in the SSH settings is disabled.

Should I open a separate issue for this or can we leave it here?

Thanks for your efforts! 🙏

@doctorfox
Copy link

doctorfox commented Jan 17, 2023

I experienced this same issue, I had to go into
Tools ->Settings -> SSH
Change from OpenSSH back to Putty
And confirm that all the paths to my external Putty installation are correct.

@pazoozooCH
Copy link

I experienced this same issue, I had to go into Tools ->Settings -> SSH Change from OpenSSH back to Putty And confirm that all the paths to my external Putty installation are correct.

I habe Putty selected, my Paths are correct, but GitExtensions still wants to start a new agent even though the external one is already running.

@doctorfox , are you using an external pageant?

@RussKie
Copy link
Member

RussKie commented Jan 17, 2023

This could be the side effect from this #10545 (comment).
Though, Pageant shouldn't be started, if it's already running...

if (!IsPageantRunning())
{
// NOTE we leave the process to dangle here
IProcess process = pageantExecutable.Start();
process.WaitForInputIdle();
}

Could you please provide a stable repro?

/cc: @gerhardol @vbjay

@pazoozooCH
Copy link

This could be the side effect from this #10545 (comment). Though, Pageant shouldn't be started, if it's already running...

if (!IsPageantRunning())
{
// NOTE we leave the process to dangle here
IProcess process = pageantExecutable.Start();
process.WaitForInputIdle();
}

Could you please provide a stable repro?

/cc: @gerhardol @vbjay

Yes, that seems very likely. I guess the problem is the way it is determined whether pageant is running:

            static bool IsPageantRunning()
            {
                var pageantProcName = Path.GetFileNameWithoutExtension(AppSettings.Pageant);
                return Process.GetProcessesByName(pageantProcName).Length != 0;
            }

This will only work if pageant is the executable defined in GitExtensions. However, in my case, the pageant service is provided by the KeePass plugin KeeAgent, so GitExtensions will think it's not running.

When I just remove the path in GitExtensions config, I will also get an error "SSH agent could not be found. '' is Putty installed?".

The root cause for me is that GitExtensions wants to start pageant even though I absolutely don't want it to. The code should take into consideration the value of the flag "Automatically start authentication client when a private key is configured for a remote" in the SSH settings. If this is not checked, GitExtensions should not try to start pageant and doesn't need to check if it's running either...

@gerhardol
Copy link
Member

History:

  • 4.0.0 removed the bundled PuTTY binaries (not following the PuTTY release cycle, could b security issues). That raised a number of users reporting issues as the binaries could not be found.
  • 4.0.1 Added a check that the binary and the key file exists. That did supposedly not follow the use case for some users.
  • 4.0.2 tweaked the putty tests. Is there anything remaining?

No one in the core team is using PuTTY, vbjay is the only regular contributor I know using PuTTY.
We have tried to get feedback for the changes but not so much response. GE is a community project.

I suggest a new issue is found to handle possible tweaking of PuTTY behavior.

@doctorfox
Copy link

I experienced this same issue, I had to go into Tools ->Settings -> SSH Change from OpenSSH back to Putty And confirm that all the paths to my external Putty installation are correct.

I habe Putty selected, my Paths are correct, but GitExtensions still wants to start a new agent even though the external one is already running.

@doctorfox , are you using an external pageant?

Yes.
My Putty installation was done separately before I installed GitExtensions.

@pazoozooCH
Copy link

History:

  • 4.0.0 removed the bundled PuTTY binaries (not following the PuTTY release cycle, could b security issues). That raised a number of users reporting issues as the binaries could not be found.
  • 4.0.1 Added a check that the binary and the key file exists. That did supposedly not follow the use case for some users.
  • 4.0.2 tweaked the putty tests. Is there anything remaining?

No one in the core team is using PuTTY, vbjay is the only regular contributor I know using PuTTY. We have tried to get feedback for the changes but not so much response. GE is a community project.

I suggest a new issue is found to handle possible tweaking of PuTTY behavior.

Thanks for the input, I've created a separate issue for this: #10656

@RussKie
Copy link
Member

RussKie commented Jan 21, 2023

Closing as the "key not found" issue is fixed in 4,0,2. The "external pageant handling" is tracked under #10656.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants