Does github support git wire protocol v2?

后端 未结 2 1281
深忆病人
深忆病人 2020-12-19 10:26

Just wanted to know whether github server supports git wire protocol-v2? - https://opensource.googleblog.com/2018/05/introducing-git-protocol-version-2.html - https://gith

相关标签:
2条回答
  • 2020-12-19 10:44

    Not yet Yes since Nov. 2018 (see the last section below).
    I have presented the protocol v2 in "How does Git's transfer protocol work", introduced in commit 9bfa0f9.

    But this new implementation only dates from Git 2.18, released in July 2018.
    It was too soon yet for GitHub to support it at the time of the OP's question.

    You can check that with:

    # Linux
    GIT_CURL_VERBOSE=2 git -c protocol.version=2 ls-remote --heads https://github.com/bower/bower.git
    
    # Windows:
    cmd /v /c "set GIT_CURL_VERBOSE=2&& git -c protocol.version=2 ls-remote --heads https://github.com/bower/bower.git"
    

    A v2 server would reply:

    S: 200 OK
    S: <Some headers>
    S: ...
    S:
    S: 000eversion 2\n
    S: <capability-advertisement>
    

    In July, I saw:

    < HTTP/1.1 200 OK
    < Server: GitHub Babel 2.0
    < Content-Type: application/x-git-upload-pack-advertisement
    < Transfer-Encoding: chunked
    < Expires: Fri, 01 Jan 1980 00:00:00 GMT
    < Pragma: no-cache
    < Cache-Control: no-cache, max-age=0, must-revalidate
    < Vary: Accept-Encoding
    < X-GitHub-Request-Id: F361:7598:2BF8FEF:518E5FB:5B541C22
    < X-Frame-Options: DENY
    

    No 000eversion 2\n yet.


    Note: (July 2018), the direction page of GitLab clearly mentions a "Support Git protocol version 2" for GitLab 11.2 (Aug. 22nd, 2018): see issue 46555.

    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: see gitlab-org/gitaly-proto merge request 208
    • (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.

    Who will be first?


    ... From this comment, GitLab might be first (Nov 2018, for GitLab 11.4)

    it looks like we're the first big Git host to support this! We should be sure to mention that in the release blog post, if we verify it is indeed the case :)

    But only HTTPS for now, not yet SSH (issue 46555)

    Git v2 over SSH won't be enabled by default either (requires SSHD changes, which we'll need to document).

    Issue 5244 confirms:

    I can see that this is working via HTTP on GitLab.com

    0 讨论(0)
  • 2020-12-19 11:09

    It happened :)

    "GitHub now supports version 2 of the Git wire protocol"

    0 讨论(0)
提交回复
热议问题