diff --git a/pkg/ssh/cmd/git.go b/pkg/ssh/cmd/git.go index d8584e45..7265c9a7 100644 --- a/pkg/ssh/cmd/git.go +++ b/pkg/ssh/cmd/git.go @@ -3,6 +3,7 @@ package cmd import ( "errors" "path/filepath" + "strings" "time" "github.com/charmbracelet/log" @@ -204,6 +205,16 @@ func gitRunE(cmd *cobra.Command, args []string) error { envs = append(envs, cfg.Environ()...) + // Add GIT_PROTOCOL from session. + if sess := sshutils.SessionFromContext(ctx); sess != nil { + for _, env := range sess.Environ() { + if strings.HasPrefix(env, "GIT_PROTOCOL=") { + envs = append(envs, env) + break + } + } + } + repoPath := filepath.Join(reposDir, repoDir) service := git.Service(cmd.Name()) stdin := cmd.InOrStdin()