Windows virtual environment: Use SSH binaries from the Git suite #63
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This hopefully fixes Windows-based builds, including issue #62.
It was a much bigger rabbit hole than initially expected, and took quite some time and experimentation. It turns out there are two versions of the
ssh
and related binaries available in the Windows virtual environment.Things seem to work when using the
ssh-agent
andssh-add
binaries provided as part of the Git installation, but not with the native Windows ones.As of writing, simple
git clone ...
operations given in a GHA workflow file will use thessh
client from the Git suite, without further configuration. I don't know if this might change in the future; git-for-windows/git#2944 is about possibly changing this.As a reminder to myself, just in case we need to get back to this sometime:
IdentityFile
cannot point to a file containing the public key part, it complains about the "invalid format".ssh-keygen -p ...
), but that would need to happen before loading into the agent, otherwise it does not recognize keys later onstdin
tossh-add
, but instead theDISPLAY
env var has to be set to some dummy value. That will makessh-add
fork the program fromSSH_ASKPASS
, where we can place a simple program to pass the value of another env var back as the passphrase.ssh
client seems to ignore keys from the agent whenIdentitiesOnly=yes
, see ssh-agent is ignored when with "IdentitiesOnly yes" config file setting PowerShell/Win32-OpenSSH#1550IdentitiesOnly=false
on Windows, if the specified keys are tried before the other ones.ssh
complaining that/dev/tty
is not a file – seems to be an issue in how that SSH client tries to detect a terminal (Update _PATH_TTY to point to the console PowerShell/openssh-portable#447)I don't know if "mixing" the SSH client and/or other binaries (the agent) from Windows and Git has any other side effects or implications.
🤞🏻