fix: Use forward slashes on Windows for gitssh (#1146)

This commit is contained in:
Kyle Carberry 2022-04-25 14:41:52 -05:00 committed by GitHub
parent fccd4fab96
commit 33b58a0363
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -12,6 +12,7 @@ import (
"os/exec"
"os/user"
"runtime"
"strings"
"sync"
"time"
@ -318,6 +319,9 @@ func (a *agent) handleSSHSession(session ssh.Session) error {
if err != nil {
return xerrors.Errorf("getting os executable: %w", err)
}
// Git on Windows resolves with UNIX-style paths.
// If using backslashes, it's unable to find the executable.
executablePath = strings.ReplaceAll(executablePath, "\\", "/")
cmd.Env = append(cmd.Env, fmt.Sprintf(`GIT_SSH_COMMAND=%s gitssh --`, executablePath))
sshPty, windowSize, isPty := session.Pty()