git-receive-pack
Receive pushed Git objects from a client
SYNOPSIS
git-receive-pack [--[no-]stateless-rpc] [--[no-]advertise-refs] [--report-status] [--push-cert[=<bool>]] [--recv-pack=<exe>] [--exec=<exe>] <directory>
PARAMETERS
--stateless-rpc
Quit after a single request; do not negotiate refs
--no-stateless-rpc
Use stateful RPC even if --stateless-rpc was specified earlier
--advertise-refs
Exit immediately after initial ref advertisement
--report-status
Send human-readable status updates to stdout
--push-cert[=<bool>]
Enable/disable signed push certificate verification (<bool> defaults to true)
--recv-pack=<exe>
Path to alternate receive-pack executable
--exec=<exe>
Path to alternate executable for hooks
DESCRIPTION
git-receive-pack is a low-level "plumbing" command in Git that implements the server-side logic for receiving push updates from a client.
It is automatically invoked by Git transports (such as SSH, HTTP, or git:// protocol) when a client runs git push. The command reads pack data and commands from the client via stdin, verifies the updates, executes repository hooks (pre-receive, update, post-receive, post-update), and applies the changes to the specified repository directory.
Key responsibilities include:
• Unpacking incoming objects and refs.
• Enforcing access controls via hooks.
• Reporting status back to the client.
This command is not intended for direct manual invocation by end-users but is crucial for Git hosting services like GitHub, GitLab, or self-hosted servers. It supports stateless RPC modes for HTTP smart protocol and can advertise refs for discovery. Security is handled through hooks and filesystem permissions, making it essential for multi-user environments.
CAVEATS
Not for direct user invocation; runs with invoker's permissions, risking security in shared setups. Requires write access to <directory>. Hooks must be properly configured for access control.
HOOKS INTEGRATION
Triggers pre-receive, update, post-receive, and post-update hooks in the repository's hooks/ directory for validation and notifications.
ENVIRONMENT VARIABLES
Respects GIT_NAMESPACE for namespacing, GIT_OBJECT_DIRECTORY, and others for custom repo layouts.
HISTORY
Introduced in the initial Git release (v0.99, April 2005) by Linus Torvalds as part of core transfer protocols. Evolved with Git's smart protocols (v1.6.6, 2009) adding stateless-rpc and push certificates (v2.1.0, 2014) for security.
SEE ALSO
git-send-pack(1), git-upload-pack(1), git-push(1), git-http-backend(1)


