Terentev Maksim
Terentev Maksim

Reputation: 266

fatal: unknown value for config 'protocol.version': 2

I decided to turn on Git protocol 2nd ver (I suppose it's faster, noiseless), so I did:

git config --global protocol.version 2

But when I try

git pull

I get an error saying:

fatal: unknown value for config 'protocol.version': 2

My OS is Ubuntu 18.04. My friend on Ubuntu 16.04 did the same and it worked for him. Am I maybe missing some dependencies?

Upvotes: 4

Views: 3060

Answers (3)

VonC
VonC

Reputation: 1328192

With Git 2.26 (Q1 2020), The transport protocol version 2 (that I presented here before) becomes the default one.
(It was reverted in 2.27, but is the default again in Q4 2020 with Git 2.29: see below)

See commit 684ceae, commit 33166f3, commit 8a1b097, commit b9ab170, commit 07ef3c6 (24 Dec 2019) by Jonathan Nieder (artagnon).
(Merged by Junio C Hamano -- gitster -- in commit 0da63da, 14 Feb 2020)

config doc: protocol.version is not experimental

Signed-off-by: Jonathan Nieder

Git's protocol version 2 has been working well in production for over a year.

Simplify documentation by no longer referring to it as experimental.

And:

fetch: default to protocol version 2

Signed-off-by: Jonathan Nieder

The Git users at $DAYJOB have been using protocol v2 as a default for ~1.5 years now and others have been also reporting good experiences with it, so it seems like a good time to bump the default version.

It produces a significant performance improvement when fetching from repositories with many refs, such as https://chromium.googlesource.com/chromium/src.

This only affects the client, not the server.

(The server already defaults to supporting protocol v2.)
The protocol change is backward compatible, so this should produce no significant effect when contacting servers that only speak protocol v0.


Warning: before Git 2.27 (Q2 2020), those fetching over protocol v2 from linux-next and other kernel repositories are reporting that v2 often fetches way too much than needed.

See commit 11c7f2a (22 Apr 2020) by Jonathan Nieder (artagnon).
(Merged by Junio C Hamano -- gitster -- in commit e896a28, 28 Apr 2020)

Revert "fetch: default to protocol version 2"

Reported-by: Lubomir Rintel
Reported-by: "Dixit, Ashutosh"
Reported-by: Jiri Slaby
Reported-by: Konstantin Ryabitsev
Signed-off-by: Jonathan Nieder

This reverts commit 684ceae32dae726c6a5c693b257b156926aba8b7.

Users fetching from linux-next and other kernel remotes are reporting that the limited ref advertisement causes negotiation to reach MAX_IN_VAIN, resulting in too-large fetches.


With Git 2.29 (Q4 2020), The transport protocol v2 has become the default again.

See commit eb04975 (25 Sep 2020) by Jeff King (peff).
(Merged by Junio C Hamano -- gitster -- in commit e76ae33, 29 Sep 2020)

protocol: re-enable v2 protocol by default

Signed-off-by: Jeff King

Protocol v2 became the default in v2.26.0 via 684ceae32d ("fetch: default to protocol version 2", 2019-12-23, Git v2.26.0-rc0 -- merge listed in batch #5).

More widespread use turned up a regression in negotiation. That was fixed in v2.27.0 via 4fa3f00abb (fetch-pack: in protocol v2, in_vain only after ACK, 2020-04-27), but we also reverted the default to v0 as a precaution in 11c7f2a30b (Revert "fetch: default to protocol version 2", 2020-04-22).

In v2.28.0, we re-enabled it for experimental users with 3697caf4b9 ("config: let feature.experimental imply protocol.version=2", 2020-05-20, Git v2.28.0-rc0 -- merge listed in batch #2) and haven't heard any complaints.

v2.28 has only been out for 2 months, but I'd generally expect people turning on feature.experimental to also stay pretty up-to-date. So we're not likely to collect much more data by waiting. In addition, we have no further reports from people running v2.26.0, and of course some people have been setting protocol.version manually for ages.

Let's move forward with v2 as the default again. It's possible there are still lurking bugs, but we won't know until it gets more widespread use. And we can find and squash them just like any other bug at this point.

If unset, the default is 2.

Upvotes: 0

alfunx
alfunx

Reputation: 3150

The Git manual for config (man git-config on Git v2.20.1) says:

protocol.version
    Experimental. If set, clients will attempt to communicate with a server
    using the specified protocol version. If unset, no attempt will be made by
    the client to communicate using a particular protocol version, this results
    in protocol version 0 being used. Supported versions:

    ·   0 - the original wire protocol.

    ·   1 - the original wire protocol with the addition of a version string in
        the initial response from the server.

    ·   2 - wire protocol version 2[2].

So 2 is not a valid value for protocol.version, and your friend probably set it to 1.

Upvotes: -1

Terentev Maksim
Terentev Maksim

Reputation: 266

This feature appeared in Git 2.18

To try out protocol version 2 for yourself you'll need an up to date version of Git (support for v2 was recently merged to Git's master branch and is expected to be part of Git 2.18) and a v2 enabled server (repositories on googlesource.com and Cloud Source Repositories are v2 enabled).

And I have Git 2.17v

Upvotes: 6

Related Questions