aboutsummaryrefslogtreecommitdiffstats
path: root/modules/ssh/ssh.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/ssh/ssh.go')
-rw-r--r--modules/ssh/ssh.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/ssh/ssh.go b/modules/ssh/ssh.go
index bffe29f4c3..5cc011e581 100644
--- a/modules/ssh/ssh.go
+++ b/modules/ssh/ssh.go
@@ -75,11 +75,21 @@ func sessionHandler(session ssh.Session) {
ctx, cancel := context.WithCancel(session.Context())
defer cancel()
+ gitProtocol := ""
+ for _, env := range session.Environ() {
+ if strings.HasPrefix(env, "GIT_PROTOCOL=") {
+ // The value would be version=2, so using normal split doesn't work here.
+ gitProtocol = strings.SplitN(env, "=", 2)[1]
+ break
+ }
+ }
+
cmd := exec.CommandContext(ctx, setting.AppPath, args...)
cmd.Env = append(
os.Environ(),
"SSH_ORIGINAL_COMMAND="+command,
"SKIP_MINWINSVC=1",
+ "GIT_PROTOCOL="+gitProtocol,
)
stdout, err := cmd.StdoutPipe()