Skip to content

Support Git protocol version 2

Starting with the upcoming Git 2.18 release, there will be a new Git protocol: version 2. The protocol is what drives git clone, git push etc and is meant to be more bandwidth efficient. The main improvements are:

  • Server-side filtering of references
  • Easy extensibility for new features like ref-in-want and fetching and pushing symrefs
  • Simplified client handling of the http transport

When Git 2.18 is released we should offer support in the next release of GitLab.

Proposal

When a Git session is established (e.g. git clone), the client can signal it supports the v2 protocol. It is then up to the server (GitLab) to decide whether to use the old v1 protocol or v2. Once Git 2.18 is released, GitLab servers will start receiving Git sessions from clients that advertise they can use v2. If we do nothing, everything just keeps working with protocol v1.

In order for GitLab servers to start answering with the v2 protocol we need to do a few things:

  • (required) install Git 2.18 on Gitaly servers in gitlab-omnibus
  • (required) propagate the Git-Protocol HTTP header in workhorse -> gitaly -> git
  • (required) propagate the Git-Protocol environment variable in sshd -> gitlab-shell -> gitaly -> git
  • (optional) gate the v2 advertisement with a feature flag so that we can stop it from reaching gitaly. That way we would be in control of whether the v2 protocol is active or not.

Links / references

Edited by James Ramsay (ex-GitLab)