Skip to content

Commit d63c5a2

Browse files
committed
fix: Use forward slashes onWindows for gitssh
1 parent 5575e3c commit d63c5a2

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
@@ -11,6 +11,7 @@ import (
1111
"os"
1212
"os/exec"
1313
"os/user"
14+
"strings"
1415
"sync"
1516
"time"
1617

@@ -236,6 +237,9 @@ func (a *agent) handleSSHSession(session ssh.Session) error {
236237
if err != nil {
237238
return xerrors.Errorf("getting os executable: %w", err)
238239
}
240+
// Git on Windows resolves with UNIX-style paths.
241+
// If using backslashes, it's unable to find the executable.
242+
executablePath = strings.ReplaceAll(executablePath, "\\", "/")
239243
cmd.Env = append(cmd.Env, fmt.Sprintf(`GIT_SSH_COMMAND=%s gitssh --`, executablePath))
240244

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

0 commit comments

Comments
 (0)