git-lfs / git-lfs

Git extension for versioning large files
https://git-lfs.com
Other
12.64k stars 2.01k forks source link

Git for Windows installer option to use OpenSSH breaks git-lfs #5746

Open ThinkChaos opened 1 month ago

ThinkChaos commented 1 month ago

Describe the bug

The Git for Windows installer has an option to use OpenSSH. This sets GIT_SSH to C:/Windows/System32/OpenSSH/ssh.exe. In git-lfs' custom subprocess logic, / is not recognized as a path separator, and thus it tries to find an exe with that name in PATH.

(Arguably it's a bug in Go oversimplifying things: os.PathSeparator is misleading as there's more than one separator on Windows, but that ship has sailed... See I want off Mr. Golang's Wild Ride for more fun gotchas.)

To Reproduce

  1. set GIT_SSH=C:/Windows/System32/OpenSSH/ssh.exe
  2. Try to use LFS

Error snippet:

batch request: executable file not found in %PATH%
error: failed to fetch some objects from '[...].git/info/lfs'

Workaround: set GIT_SSH=C:\Windows\System32\OpenSSH\ssh.exe
(or in the Windows environment variable settings for system wide fix)

Expected behavior

No error.

System environment

Git for Windows

Output of git lfs env

git-lfs/3.5.1 (GitHub; windows amd64; go 1.21.7; git e237bb3a)
git version 2.45.0.windows.1

[...]
GIT_SSH=C:/Windows/System32/OpenSSH/ssh.exe
[...]
chrisd8088 commented 1 month ago

Hey, thanks for the report! I've marked this as a Windows bug and put it into our backlog.

One thing for us to keep in mind is that we might remove our custom executable-lookup logic, now that it's no longer needed (see #5612), and so anything we do to try to resolve this problem should, ideally, avoid introducing more custom logic into that code.