【问题标题】:fatal: unknown value for config 'protocol.version': 2致命:配置“protocol.version”的未知值:2
【发布时间】:2020-10-02 04:35:43
【问题描述】:

我决定开启 Git 协议 2nd ver(我想它更快、更无噪音),所以我做了:

git config --global protocol.version 2

但是当我尝试时

git pull

我收到一条错误消息:

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

我的操作系统是 Ubuntu 18.04。我在 Ubuntu 16.04 上的朋友做了同样的事情,并且对他有用。我可能缺少一些依赖项吗?

【问题讨论】:

    标签: git


    【解决方案1】:

    此功能出现在Git 2.18

    要亲自试用协议版本 2,您需要最新版本的 Git(对 v2 的支持最近已合并到 Git 的主分支,预计将成为 Git 2.18 的一部分)和启用 v2 的服务器(存储库在 googlesource.com 和 Cloud Source Repositories 上启用了 v2)。

    我有 Git 2.17v

    【讨论】:

    • 还有我朋友的 git 2.7 版本,它忽略了协议版本(嗨,尝试设置 4 版本,没有错误)
    【解决方案2】:

    使用 Git 2.26(2020 年第一季度),传输协议版本 2(之前的 I presented here)成为默认版本
    (它在 2.27 中恢复,但在 2020 年第四季度再次使用 Git 2.29 恢复默认设置:见下文)

    commit 684ceaecommit 33166f3commit 8a1b097commit b9ab170commit 07ef3c6(2019 年 12 月 24 日)Jonathan Nieder (artagnon)
    (由Junio C Hamano -- gitster -- 合并到commit 0da63da, 2020 年 2 月 14 日)

    config doc:protocol.version 不是实验性的

    签字人:Jonathan Nieder

    Git 的协议版本 2 已经在生产环境中运行了一年多。

    不再将其称为实验性文档,从而简化文档。

    还有:

    fetch:默认为协议版本 2

    签字人:Jonathan Nieder

    $DAYJOB 的 Git 用户使用 v2 作为默认协议已有大约 1.5 年了,其他人也报告了使用它的良好体验,因此现在似乎是升级默认版本的好时机。

    从具有许多引用的存储库中获取时,它会显着提高性能,例如https://chromium.googlesource.com/chromium/src

    这只会影响客户端,不会影响服务器。

    (服务器已默认支持协议 v2。)
    协议更改是向后兼容的,因此在联系仅使用协议 v0 的服务器时应该不会产生重大影响。


    警告:在 Git 2.27(2020 年第二季度)之前,那些从 linux-next 和其他内核存储库通过协议 v2 获取的人报告说,v2 获取的数据通常比需要的多。

    参见 Jonathan Nieder (artagnon)commit 11c7f2a(2020 年 4 月 22 日)。
    (由 Junio C Hamano -- gitster -- 合并到 commit e896a28,2020 年 4 月 28 日)

    Revert "fetch:默认为协议版本 2"

    报告人:Lubomir Rintel
    报告人:“Dixit, Ashutosh”
    报告人:Jiri Slaby
    报告人:Konstantin Ryabitsev
    签字人:Jonathan Nieder

    这将还原commit 684ceae32dae726c6a5c693b257b156926aba8b7

    从 linux-next 和其他内核远程获取的用户报告说,有限的 ref 通告导致协商到达 MAX_IN_VAIN,,从而导致获取过大。


    随着 Git 2.29(2020 年第四季度),传输协议 v2 再次成为默认协议。

    参见Jeff King (peff)commit eb04975(2020 年 9 月 25 日)。
    (由 Junio C Hamano -- gitster -- 合并到 commit e76ae33,2020 年 9 月 29 日)

    protocol:默认重新启用v2协议

    签字人:杰夫·金

    通过684ceae32d(“fetch:默认为协议版本 2”,2019-12-23,Git v2.26.0-rc0 -- merge 在 @987654346 中列出的协议 v2 成为 v2.26.0 中的默认值@)。

    更广泛的使用导致了谈判的倒退。这已在 v2.27.0 中通过4fa3f00abb 修复(fetch-pack:在协议 v2 中,in_vain 仅在 ACK 之后,2020-04-27),但我们还在11c7f2a30b 中将默认设置恢复为 v0 作为预防措施( Revert "fetch: default to protocol version 2", 2020-04-22)。

    在 v2.28.0 中,我们使用 3697caf4b9 ("config: let feature.experimental imply protocol.version=2", 2020-05-20, Git v2.28.0-rc0) 为实验用户重新启用它-- mergebatch #2 中列出)并且没有听到任何投诉。

    v2.28 仅发布了 2 个月,但我通常希望打开 feature.experimental 的人们也能保持最新状态。因此,我们不太可能通过等待来收集更多数据。此外,我们没有来自运行 v2.26.0 的人的进一步报告,当然有些人多年来一直在手动设置 protocol.version。

    让我们再次将 v2 作为默认设置。可能仍然存在潜伏的错误,但在它得到更广泛的使用之前我们不会知道。我们现在可以像其他任何错误一样找到并压制它们。

    如果未设置,则默认为2

    【讨论】:

      【解决方案3】:

      config(Git v2.20.1 上的man git-config)的 Git 手册说:

      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].
      

      所以2 不是protocol.version 的有效值,您的朋友可能将其设置为1

      【讨论】:

      • 在 2.20.1 版本上,它还说:2 - wire protocol version 2[2].
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-02
      • 2021-09-08
      • 1970-01-01
      • 1970-01-01
      • 2018-12-08
      • 2016-07-06
      相关资源
      最近更新 更多