Skip to content

Forward Git SSH sessions from gitlab-shell to Gitaly Server Implementation

~Conversation: #218 (closed)

Depends on Migration Analysis #91 (closed)

Depends on RPC Design gitaly-proto!5 (merged)


Server Implementation Forward Git SSH sessions from gitlab-shell to Gitaly

Goal: allow Gitaly to monitor and control the git upload-pack and git receive-pack server-side processes spawned by the Git SSH transport.

We already have a protocol for this. https://gitlab.com/gitlab-org/gitaly-proto/blob/v0.5.0/ssh.proto

We want to be able to run two commands on behalf of SSH clients: git upload-pack and git receive-pack. Each has its own RPC SSHUploadPack and SSHReceivePack.

The idea behind the current proto is:

  • read first request message to get Repository and some metadata (GL_ID variable) in case of receive-pack
  • start the git process requested for the correct git repository path
  • in a goroutine: copy the rest of the request stream to stdin
  • in two goroutines: copy the stdout and stderr streams to the response
  • wait for the git command, out and err streams to finish
  • send final response message containing the git exit code
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information