GITPROTOCOL-V2(5) Git GITPROTOCOL-V2(5) (NAME) gitprotocol-v2 - (Wire Protocol) (SYNOPSIS) (DESCRIPTION) (Wire Protocol) . : o o (capabilities) NUL pkt-line o NUL ( agent symref ls-refs ) o (reference advertisement) o ls-refs (refs) o http stateless-rpc. (flush semantics) http - . . . . - (PACKET-LINE FRAMING) - (packet-line framing) . gitprotocol-pack(5) gitprotocol-common(5) . : o 0000 (flush-pkt) - o 0001 (delim-pkt) - o 0002 (response-end-pkt) - (stateless) (INITIAL CLIENT REQUEST) version=2 GIT_PROTOCOL . gitprotocol-pack(5) gitprotocol- http(5) GIT_PROTOCOL git(1) . . Git (Git Transport) git:// "version=2" : 003egit-upload-pack /project.git\0host=myserver.com\0\0version=2\0 SSH File (SSH and File Transport) ssh:// file:// GIT_PROTOCOL "version=2" . . HTTP (HTTP Transport) http:// https:// "" info/refs gitprotocol-http(5) "version=2" Git-Protocol . C: GET $GIT_URL/info/refs?service=git-upload-pack HTTP/1.0 C: Git-Protocol: version=2 : S: 200 OK S: S: ... S: S: 000eversion 2\n S: $GIT_URL/git-upload-pack . ( git-receive-pack ). --http-backend-info-refs git- upload-pack(1) . GIT_PROTOCOL . git-http-backend(1) . (CAPABILITY ADVERTISEMENT) ( ) . (key) (value) . . . . capability-advertisement = protocol-version capability-list flush-pkt protocol-version = PKT-LINE("version 2" LF) capability-list = *capability capability = PKT-LINE(key[=value] LF) key = 1*(ALPHA | DIGIT | "-_") value = 1*(ALPHA | DIGIT | " -_.,?\/{}[]()<>!@#$%^&*+=:;") (COMMAND REQUEST) . . . request = empty-request | command-request empty-request = flush-pkt command-request = command capability-list delim-pkt command-args flush-pkt command = PKT-LINE("command=" key LF) command-args = *command-specific-arg command-specific-args are packet line framed arguments defined by each individual command. . . (MUST) . flush-pkt . . flush-pkt . (CAPABILITIES) : (fetch push ). (stateless) . (single round) . (MUST NOT). (round-robin load-balancing) . agent agent X ( agent=X) X . agent Y ( agent=Y) agent ( agent - MUST NOT). X Y ASCII ( < x < ) "package/version-os" ( "git/1.8.3.1-Linux") os ( "Linux"). X Y GIT_USER_AGENT . os sysname uname(2) . agent (MUST NOT) . ls-refs ls-refs (reference advertisement) . ls-refs . : "= " ls-refs : symrefs (symbolic ref) . peel (peeled tags) . ref-prefix . . (MAY) . unborn . unborn HEAD symref (unborn branch) "unborn HEAD symref-target:" . ls-refs : output = *ref flush-pkt obj-id-or-unborn = (obj-id | "unborn") ref = PKT-LINE(obj-id-or-unborn SP refname *(SP ref-attribute) LF) ref-attribute = (symref | peeled) symref = "symref-target:" symref-target peeled = "peeled:" obj-id fetch fetch packfile . fetch ref-advertisement ( ls-refs ) . : "= " fetch : want . want . have . packfile . 'have' . done ( clone ) packfile . thin-pack thin pack ( ). "" (thicken) . no-progress packfile (side-band channel 2) . . include-tag (annotated tags) . ofs-delta PACKv2 oid . OBJ_OFS_DELTA ( ) packfile . shallow shallow-info . shallow (shallow) ( ) 'shallow ' . . deepen fetch/clone . deepen-relative "deepen" . deepen-since clone/fetch . "git rev-list --max-age=" . "deepen" . deepen-not clone/fetch '' . "git rev-list --not " . "deepen" "deepen-since" . filter : filter packfile . (partial clone) (partial fetch) . "filter-spec" `rev-list` . (SHOULD) ( "1k") ( "1024") . (SHOULD) : 'k' 'm' 'g' . ref-in-want wanted-refs . want-ref . want-ref . sideband-all : sideband-all () packfile . flush delim PKT-LINE ( packfile) ( ) "0005\2" ( PKT-LINE ) (keepalive) . packfile-uris packfile-uris . packfile-uris . packfile-uris packfile URI . URI . "http" "https" . wait-for-done . wait-for-done "ready" packfile "done" . fetch (0001) . packfile . output = acknowledgements flush-pkt | [acknowledgments delim-pkt] [shallow-info delim-pkt] [wanted-refs delim-pkt] [packfile-uris delim-pkt] packfile flush-pkt acknowledgments = PKT-LINE("acknowledgments" LF) (nak | *ack) (ready) ready = PKT-LINE("ready" LF) nak = PKT-LINE("NAK" LF) ack = PKT-LINE("ACK" SP obj-id LF) shallow-info = PKT-LINE("shallow-info" LF) *PKT-LINE((shallow | unshallow) LF) shallow = "shallow" SP obj-id unshallow = "unshallow" SP obj-id wanted-refs = PKT-LINE("wanted-refs" LF) *PKT-LINE(wanted-ref LF) wanted-ref = obj-id SP refname packfile-uris = PKT-LINE("packfile-uris" LF) *packfile-uri packfile-uri = PKT-LINE(40*(HEXDIGIT) SP *%x20-ff LF) packfile = PKT-LINE("packfile" LF) *PKT-LINE(%x01-03 *%x00-ff) acknowledgments * "done" ( packfile ) acknowledgments (MUST) . o "acknowledgments" o have "NAK" . o have "ACK obj-id" . o "ACK" "NAK" . o "ready" packfile ( packfile ) o "ready" ( ) "ACK" . . shallow-info * fetch/clone fetch shallow-info . shallow-info ( ) . o "shallow-info" o . o packfile "shallow obj-id" . o fetch ( packfile ) "unshallow obj-id" . o (MUST NOT) "unshallow" . wanted-refs * 'want-ref' packfile . o "wanted-refs" . o want-ref (" ") . o (MUST NOT) want-ref . packfile-uris * 'packfile-uris' URI . o "packfile-uris" . o URI ( git index-pack ) URI . o . Git . ( index-pack "pack\t" "keep\t" ). packfile * 'want' 'done' packfile . o "packfile" o packfile o packfile (multiplexed) side-band-64k . packfile pkt-line ( pkt-line) . : 1 - (pack data) 2 - (progress messages) 3 - (fatal error message) server-option . "server-option=