Git Transfer Protocol Specifications

后端 未结 2 1953
执笔经年
执笔经年 2021-02-14 17:49

I\'m playing around with git\'s transfer protocols, and I was just wondering if there is some detailed specification for them before I attempt to read the source?

2条回答
  •  花落未央
    2021-02-14 18:30

    Update May 2018: Starting Q2 2018 and Git 2.18, you will have the Git transfer protocol v2: See "How does Git's transfer protocol work".


    Original answer 2013:

    First, check the git documentation in the git repo itself (with a good grep, available even on Windows):

    git clone https://github.com/git/git
    cd git/Documentation
    grep -nRHI "receive-pack" *
    

    That will give you pointers to:

    • http-protocol But also:
    • pack-heuristics
    • pack-protocol
    • protocol capabilities
    • send-pack pipeline

    Then you can complete that set of documentation with ones related to the backend commands:

    • git-http-backend
    • git-receive-pack
    • git-remote-ext
    • git-send-pack
    • gitremote-helpers

    One way at looking at the source is by looking at the recent evolutions around transfer and transport in the git repo:

    git clone https://github.com/git/git
    cd git
    git log -Stransfer
    

    Have a look at:

    • commit 4bc444 (Support FTP-over-SSL/TLS for regular FTP)
    • commit daebaa (upload/receive-pack: allow hiding ref hierarchies )
    • commit 745f7a (fetch-pack: move core code to libgit.a)
    • commit fe0435 (Add persistent-https to contrib)
    • ...

    Another way is to have a look at other implementation of git:

    • Java: jgit, and its Transport.java source (tested in TransportTest.java, which declines into:
      • TCpTransport
      • TransportHttp
      • TransportSftp
      • TransportLocal
      • TransportBundle

     

    • C, with libgit2, and its src/transports sources.

    • ... and so on

提交回复
热议问题