git-http-fetch
Download objects over HTTP or HTTPS
SYNOPSIS
git http-fetch [--stdin | --stdout] [--prefix=<prefix>/] [-c] [-v] [-h] [-L] [-t] [-w <ref>] [--recover] <url> [<sha1> ...]
PARAMETERS
--stdin
Read object SHA-1s from stdin (one per line or 'sha1 type size'; default unless --stdout)
--stdout
Write fetched objects/packs to stdout instead of files
--prefix=<prefix>/
Store objects in <prefix>/<sha1> instead of .git/objects
-c
Use curl's --netrc option for authentication
-v
Enable verbose output
-h
Print usage help
-L
Follow HTTP redirects (curl --location)
-t
Enable HTTP TRACE requests
-w <ref>
Write <ref> (e.g., FETCH_HEAD) after fetching pack
--recover
Continue despite existing lockfiles (for interrupted fetches)
<url>
Base URL to remote repo objects (required positional)
<sha1> ...
SHA-1 hash(es) of objects to fetch (required positional)
DESCRIPTION
git-http-fetch is a plumbing command in Git that downloads specific objects or packfiles from a remote Git repository using the HTTP/HTTPS protocol. It is invoked internally by higher-level commands like git fetch and git fetch-pack when the remote uses HTTP transport. The command requires a base URL to the repository's object directory (typically ending in /objects/) and one or more SHA-1 hashes of objects to fetch.
It supports reading object identifiers from stdin (default), writing to stdout, or storing fetched data prefixed by a directory path. Additional features include verbose output, curl netrc support for authentication, redirect following, HTTP tracing, and recovery from interrupted fetches. After fetching a pack, it can update a local ref.
This command handles the nitty-gritty of HTTP requests for loose objects or packs but is not intended for direct end-user use. Modern Git prefers protocol v2 over HTTP for efficiency, making git-http-fetch more legacy in smart HTTP setups.
CAVEATS
Plumbing command; avoid direct use. Legacy for dumb HTTP; prefer smart HTTP or protocol v2. Requires curl. Fails on authenticated repos without proper setup.
STDIN FORMAT
Lines as '<sha1>' or '<sha1> <type> <size>' for precise object requests.
Outputs pack to prefix/pack/ if multiple objects.
AUTHENTICATION
Uses HTTP Basic via curl/netrc or GIT_ASKPASS. No built-in credential helper support.
HISTORY
Introduced in Git 1.3.0 (2006) to enable HTTP fetch support alongside git-http-push. Evolved with curl integration; deprecated for new HTTP features favoring git-http-backend since Git 1.6.6.
SEE ALSO
git-fetch-pack(1), git-http-backend(1), git-fetch(1), git-upload-pack(1)


