Skip to content

Commit 049d0bb

Browse files
committed
fix: Use forward slashes on Windows for gitssh (#1146)
1 parent f67b7d0 commit 049d0bb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

agent/agent.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"os/exec"
1313
"os/user"
1414
"runtime"
15+
"strings"
1516
"sync"
1617
"time"
1718

@@ -318,6 +319,9 @@ func (a *agent) handleSSHSession(session ssh.Session) error {
318319
if err != nil {
319320
return xerrors.Errorf("getting os executable: %w", err)
320321
}
322+
// Git on Windows resolves with UNIX-style paths.
323+
// If using backslashes, it's unable to find the executable.
324+
executablePath = strings.ReplaceAll(executablePath, "\\", "/")
321325
cmd.Env = append(cmd.Env, fmt.Sprintf(`GIT_SSH_COMMAND=%s gitssh --`, executablePath))
322326

323327
sshPty, windowSize, isPty := session.Pty()

0 commit comments

Comments
 (0)