Repository navigation
Conversation
Win32-OpenSSH and Git for Windows ssh both expand `~` from HOME when it is set, so the `~/...` Include matched nothing when HOME pointed away from the profile, and the workspace host lost its ProxyCommand. - Keep the `~/...` Include whenever ssh expands `~` to the profile, so that output is unchanged. Otherwise write the absolute path in each spelling a Windows build reads: `C:/...` for Win32-OpenSSH 8.1+, `/c/...` for MSYS builds such as Git for Windows. Each build skips the one it cannot match. - Without `-F`, Git for Windows ssh reads HOME's `.ssh/config`, so it gains the include block too when HOME is a drive or UNC path. A failure warns. - Write `%` in Include paths as the glob `?`, since OpenSSH 9.9+ expands %-tokens there and older builds don't. Such paths used to throw. - Run the post-write `ssh -G` with `-v` and report which files ssh read when it resolves no ProxyCommand. Verified on Windows Server 2025 against Win32-OpenSSH 7.7p1 to 10.4p1 and Git for Windows 2.30 to 2.56: no case that worked before regressed. Closes VSC-58
ssh expands ~ from HOME when it is set, so the test failed on a Windows machine whose HOME is not the profile.
Writes the HOME ssh config inline in updateSSHConfig, shortens comments, and folds overlapping test cases into tables that check the whole rendered file. The % case now runs only against real OpenSSH.
An 8.3 name, junction or subst drive for the profile compared as a different directory, so the include switched to absolute paths, which Win32-OpenSSH 7.7 cannot read. The real path sees through all three and falls back to the resolved path when it cannot be read.
EhabY
marked this pull request as ready for review
November 24, 2026 15:07
Pass the directory ssh expands ~ from into updateInclude instead of re-reading HOME per call, replace the path spelling array with toMsysPath, and report all of ssh -v's stderr when no ProxyCommand resolves. Windows include tests now run only on Windows.
jeremyruppel
approved these changes
Nov 24, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
On Windows the extension writes the shared SSH
Includeas~/AppData/.... Both Win32-OpenSSH and Git for Windows ssh expand~fromHOMEwhen it is set. WithHOMEon another drive (for example a network homeH:\), the include matches nothing, the workspace host gets noProxyCommand, and the connection fails. Regression since #1061.Fix
IncludeargumentHOMEunset or equal to the profile (almost everyone)"~/AppData/Roaming/coder.coder-remote/ssh/*.conf"HOMEelsewhere, or data dir outside the profile"C:/Users/u/.../ssh/*.conf" "/c/Users/u/.../ssh/*.conf"//server/share/...argumentC:/..., MSYS builds such as Git for Windows read/c/.... Each build silently skips the one it cannot match, so nothing is included twice. The spellings live in one list (WINDOWS_PATH_SPELLINGS).HOMEis compared with the profile by real path, so casing, slashes, 8.3 short names, junctions andsubstdrives that reach the profile keep the~/...line. When the real path can't be read, the resolved path is compared instead.-F, Git for Windows ssh readsHOME\.ssh\config, so that file also gets the include block whenHOMEis a drive or UNC path. A failure there only logs a warning.%in the path is written as the glob?. OpenSSH 9.9+ expands%tokens inIncludeand older builds don't, so no escape works on both. These paths used to throw.ssh -Gcheck now runs with-v. When noProxyCommandresolves, the logged error lists the files ssh read and the includes that matched nothing. No extra process.Verification
Measured on Windows Server 2025 with Win32-OpenSSH 7.7p1 to 10.4p1 (including the inbox 9.5p2) and Git for Windows 2.30 to 2.56, using the branch's
SshConfigto write real configs:main; 99 cells fixed.HOMEspellings of the profile: empty, forward slashes, trailing slash, lowercase,..segments, 8.3 short name,substdrive, junction, literal%USERPROFILE%, MSYS/c/..., relative.main: Win32-OpenSSH 7.7p1 (Server 2019) whenever~can't be used, and Git ssh without-FwhenHOMEis an MSYS path such as/c/....HOMEunset, equal to the profile, and elsewhere. Another pointsHOMEat a real junction to the profile and checks the~/...line stays.Closes VSC-58. Refs VSC-8, #1197.
Measurements, design and decision log
Which
Includearguments each build reads1,260
ssh -v -G -Fruns across 15 builds.HOMEvalues: unset, the profile, the profile uppercased,H:\(a real SMB-mapped drive),C:\hshare,/c/hshare.~/...(before)HOMEunset or equalHOMEunset or equalHOMEunset or equalC:/...~/.ssh/C:/...)/c/.../cygdrive/c/...//host/share/..."C:/..." "/c/...""~/..." "/c/..."HOMEunset or equalHOMEunset or equalHOMEis equalOther findings:
-v).-F, Win32-OpenSSH always readsUSERPROFILE\.ssh\config; Git ssh readsHOME/.ssh/config.Writing
%%unknown key %z) or silently wrong (%dbecomes the home dir)%%[%]?Also confirmed on Linux OpenSSH 10.2. Cost of
?: it also matches a sibling directory that differs only in that character.End-to-end result per scenario
The branch's
SshConfigwrote the configs on the VM; every build then resolved them with-Fand with default lookup.-F-FHOMEunset, equal, or equal with other caseHOME=H:\orC:\hshareHOME=/c/hshareD:%and[]in data dir~works (threw before)Decisions
HOMEcheck: a plain string comparison treated an 8.3 name, junction orsubstdrive of the profile as a different directory. That switched to absolute paths and broke Win32-OpenSSH 7.7. The check is async so a slow networkHOMEnever blocks the extension host.HOME: treated as unset, so the~/...line is unchanged. Absolute paths fixed the newer builds measured with an emptyHOME(inbox 9.5p2, 10.4p1, Git 2.56) but break 7.7, which handles~with an emptyHOME."C:/..." "/c/..."for everyone. Win32-OpenSSH 7.7p1 readsC:/as relative, so it would break users who work today.~/...and adding/c/.... Git ssh users withHOMEequal to the profile would read every file twice.HOMEconfig is only written for drive or UNCHOMEvalues, so nothing goes to a guessed location./cygdrive/c/.... Adding it is one entry inWINDOWS_PATH_SPELLINGS.🤖 Generated by Coder Agents on behalf of @EhabY.