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?
-
Note: 5 years later, I have updated [my answer below](https://stackoverflow.com/a/18799460/6309) to reference the **Git transfer protocol v2** which comes with Git 2.18 in Q2 2018. – VonC May 10 '18 at 13:27
2 Answers
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:
Then you can complete that set of documentation with ones related to the backend commands:
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 inTransportTest.java
, which declines into:
C, with libgit2, and its
src/transports
sources.... and so on

- 1,262,500
- 529
- 4,410
- 5,250
-
Von, thanks for the great answer. I wasn't looking in the right places. – Emil Davtyan Sep 14 '13 at 12:13
-
1See also [Packfile transfer protocols](https://www.kernel.org/pub/software/scm/git/docs/technical/pack-protocol.html), [Git Protocol Capabilities](https://www.kernel.org/pub/software/scm/git/docs/technical/protocol-capabilities.html), [Smart HTTP Transport](http://git-scm.com/blog/2010/03/04/smart-http.html) for informative, although maybe old, information. – Abbafei Jun 18 '14 at 06:31
-
Note: pack-protocol finally (Git 2.5, July 2015) get to mention smart http: https://github.com/git/git/commit/486b51bc81e486c654ac35554b284816f4a6ae5c – VonC Jun 18 '15 at 23:13
there is also a partially completed documentation hosted on Github Gist.
This metasploit module also poses as a malicious dumb git server, serving bad git trees. You can see how the git trees are constructed.

- 925
- 1
- 8
- 18