Conversation: gitaly-ssh command

Feature Flag Name: gitaly_fetch_ref



We need to be able to pull from a Git repository on another Gitaly server.

Our idea is to re-use the SSHUploadPack RPC with a mock SSH transport like we do in the SSHUploadPack tests. This means we should take the test helper executable we use there and modify it into something we can use in production code.

I propose the following:

  • executable in cmd/gitaly-ssh/main.go
  • in source installations this will end up as /home/git/gitaly/gitaly-ssh
  • in omnibus this will end up as /opt/gitlab/embedded/bin/gitaly-ssh
  • we add a config.toml option gitaly_libexec_dir and use that to build the path to the executable

Example invocation:

export GITALY_TOKEN='123secret'
export GIT_SSH_COMMAND='/path/to/gitaly-ssh tcp://1.2.3.4:6000 upload-pack "{Repository: bla bla first request as JSON}"'
git clone git@localhost:foo/bar.git

The JSON can be encoded/decoded with jsonpb and SSHUploadPackRequest.encode_json.

Edited by Andrew Newdigate