<commit_before>---
description: "Set and configure Git protocol v2"
---

# Configuring Git Protocol v2

> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/issues/46555) in GitLab 11.4.

Git protocol v2 improves the v1 wire protocol in several ways and is
enabled by default in GitLab for HTTP requests. In order to enable SSH,
further configuration is needed by the administrator.

More details about the new features and improvements are available in
the [Google Open Source Blog](https://opensource.googleblog.com/2018/05/introducing-git-protocol-version-2.html)
and the [protocol documentation](https://github.com/git/git/blob/master/Documentation/technical/protocol-v2.txt).

## Requirements

From the client side, `git` `v2.18.0` or newer must be installed.

From the server side, if we want to configure SSH we need to set the `sshd`
server to accept the `GIT_PROTOCOL` environment,

```
# /etc/ssh/sshd_config
AcceptEnv GIT_PROTOCOL
```

Once configured, restart the SSH daemon. In Ubuntu, run:

```sh
sudo service ssh restart
```

## Instructions

In order to use the new protocol, clients need to either pass the configuration
`-c protocol.version=2` to the git command, or set it globally:

```sh
git config --global protocol.version 2
```<commit_msg>Add information on support for git v2 in docs<commit_after>---
description: "Set and configure Git protocol v2"
---

# Configuring Git Protocol v2

> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/issues/46555) in GitLab 11.4.

Git protocol v2 improves the v1 wire protocol in several ways and is
enabled by default in GitLab for HTTP requests. In order to enable SSH,
further configuration is needed by the administrator.

More details about the new features and improvements are available in
the [Google Open Source Blog](https://opensource.googleblog.com/2018/05/introducing-git-protocol-version-2.html)
and the [protocol documentation](https://github.com/git/git/blob/master/Documentation/technical/protocol-v2.txt).

## Requirements

From the client side, `git` `v2.18.0` or newer must be installed.

From the server side, if we want to configure SSH we need to set the `sshd`
server to accept the `GIT_PROTOCOL` environment.

In installations using [GitLab Helm Charts](../install/kubernetes/gitlab_chart.md)
and [All-in-one docker image](https://docs.gitlab.com/omnibus/docker/), the SSH
service is already configured to accept the `GIT_PROTOCOL` environment and users
need not do anything more.

For Omnibus GitLab and installations from source, you have to manually update
the SSH configuration of your server:

```
# /etc/ssh/sshd_config
AcceptEnv GIT_PROTOCOL
```

Once configured, restart the SSH daemon. In Ubuntu, run:

```sh
sudo service ssh restart
```

## Instructions

In order to use the new protocol, clients need to either pass the configuration
`-c protocol.version=2` to the git command, or set it globally:

```sh
git config --global protocol.version 2
```
{'fraction_non_alphanumeric': 0.09352761775669265, 'fraction_numerical': 0.017960013554727212, 'mean_word_length': 4.548872180451128, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 7, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4208815', 'n_tokens_mistral': 936, 'n_tokens_neox': 851, 'n_words': 356}