Skip to content

Git SSH conflicting with OpenSSH integrated in Windows #2944

@stefano-xy

Description

@stefano-xy
  • I was not able to find an open or closed issue matching what I'm seeing

Git for Windows installs SSH binaries by default, together with a lot of other linux tools.

Starting from (at least) Windows 10 version 19.09, Microsoft integrated directly a version of OpenSSH client. For example, ssh-agent is a proper Windows Service, that seems to persist the keys somewhere in the user profile. I think this is even installed by default, while the corresponding OpenSSH server is also available for a manual installation. Both can be installed via the Manage Optional Features settings panel.

Get-Command -Name ssh*

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Application     ssh.exe                                            7.7.2.1    C:\WINDOWS\System32\OpenSSH\ssh.exe
Application     ssh-add.exe                                        7.7.2.1    C:\WINDOWS\System32\OpenSSH\ssh-add.exe
Application     ssh-agent.exe                                      7.7.2.1    C:\WINDOWS\System32\OpenSSH\ssh-agent.exe
Application     ssh-keygen.exe                                     7.7.2.1    C:\WINDOWS\System32\OpenSSH\ssh-keygen.exe
Application     ssh-keyscan.exe                                    7.7.2.1    C:\WINDOWS\System32\OpenSSH\ssh-keyscan.exe

The problem is that the OpenSSH integrated in Windows and what is shipped with Git for Windows don't talk to each other. Keys added to the ssh-agent Windows service are not looked up by git command from Git for Windows when working with ssh:// repositories. Depending on the order of entries in the PATH environment variable, one is used by default instead of another. On my installation, VS Code launches the Windows' ssh and expect keys to be available in the Windows' service. Using start-ssh-agent works, but that agent is not consulted.

The general solution is to configure GIT_SSH, pointing explicitly to the implementation wanted, but this is a manual process users have to discover first, and then do.

To avoid this overlap, I propose that an option is given not to install SSH together with Git for Windows. I can't suggest what its default setting should be, or if it's better to build a package without SSH, or else, but I think you should be aware of the problem and think about a better integration with recent versions of Windows 10.

Additional info: https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_overview

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions