Lives on the remote. Validates and stores incoming packs.
git receive-pack is the server-side process that accepts a push. It lives on the remote, reads update commands and the incoming packfile from stdin, runs the pre-receive/update/post-receive hooks, and atomically moves the refs.
Push is a two-process conversation: git push on the client spawns send-pack, which talks (over ssh, smart HTTP, or git://) to receive-pack on the server. receive-pack is the bouncer, the warehouse, and the ref clerk in one binary.
git receive-pack [--http-backend-info-refs] <directory>
Invoked by the transport layer (sshd, `git http-backend`, `git daemon`); users almost never run it directly. `<directory>` is the path to the target repository on the server.| Flag | What it does |
|---|---|
<directory> | Path to the bare or non-bare repo that is receiving the push. |
--http-backend-info-refs | Emit the smart-HTTP advertisement format instead of starting a session. |
(implicit) stdin protocol | Reads <old-sha> <new-sha> <ref> update commands followed by a packfile. |
(implicit) hooks | Runs pre-receive, then per-ref update, then post-receive and post-update. |
(implicit) atomic refs | With receive.atomic=true (or --atomic on the client) ref updates land all-or-nothing. |
git push ultimately talks to.pre-receive and update hooks (lint, signed-commit checks, branch ACLs).post-receive.receive-pack emits.ssh git@127.0.0.1 git-receive-pack '/srv/git/repo.git'git receive-pack --http-backend-info-refs /srv/git/repo.gitecho 'exec >&2; while read o n r; do [ "$o" = 0000000000000000000000000000000000000000 ] || git merge-base --is-ancestor "$o" "$n" || exit 1; done' > hooks/pre-receive && chmod +x hooks/pre-receivegit config receive.atomic truepre-receive as the policy gate -- failing here cancels the whole push cleanly.receive.atomic = true so a multi-ref push is all-or-nothing, not half-applied.receive-pack by hand -- let sshd / http-backend / git daemon invoke it.receive.atomic, a partial push can leave some refs updated and others not.post-receive runs after refs move -- failure there does NOT roll the push back; use pre-receive for blocking checks.Hit each option, then Check answers. Score is recorded; Next is always open.