Endpoint
Repository owner username or organization name
Repository name (with or without
.git suffix)Authentication
This endpoint supports HTTP Basic Authentication. Public repositories allow anonymous read access, while private repositories require authentication.Request
Headers
Content type for upload-pack requests
HTTP Basic Authentication credentials (required for private repos)
Body
The request body contains pkt-line encoded commands. Two commands are supported:ls-refs command
Lists references available in the repository.Include peeled references (annotated tags)
Include symbolic reference targets (e.g., HEAD)
Filter references by prefix (can be specified multiple times)
fetch command
Fetches objects from the repository.Object ID (SHA-1) the client wants to fetch. Can be specified multiple times.
Object ID (SHA-1) the client already has. Can be specified multiple times.
Client has sent all have lines and is ready to receive packfile
Request thin pack format (delta references to objects not in pack)
Suppress progress messages in side-band channel 2
Include tags that reference wanted commits
Support offset deltas in packfile
Multiplex all output through side-band
Mark commit as shallow boundary. Can be specified multiple times.
Deepen shallow clone by specified number of commits
Deepen relative to current shallow boundary
Deepen to commits newer than timestamp
Deepen until specified ref is not reachable
Partial clone filter specification (e.g.,
blob:none, tree:0)Response
ls-refs response
HTTP status code (200 for success)
application/x-git-upload-pack-resultPkt-line encoded reference list
fetch response
HTTP status code (200 for success, 500 for pack errors)
application/x-git-upload-pack-resultPkt-line encoded response with optional packfile
done:
Without done (negotiation phase)
With done (packfile delivery)
- Channel 1: Packfile data
- Channel 2: Progress messages (unless
no-progress) - Channel 3: Error messages
Examples
List all references
Fetch specific commit
Implementation details
The upload-pack endpoint is implemented across several components:Route handler
apps/web/src/routes/$owner/$repo/git-upload-pack.ts:5
Handles authentication and forwards requests to the Durable Object:
Durable Object handler
apps/web/src/do/repo.ts:100
Processes the request within the repository Durable Object:
Protocol implementation
apps/web/src/do/repo.ts:157
Handles command parsing and execution:
Core protocol functions
The protocol implementation uses these key functions:parseCommand(): Parse command and arguments from pkt-line data (apps/web/src/git/protocol.ts:173)parseFetchRequest(): Extract fetch parameters (apps/web/src/git/protocol.ts:243)buildLsRefsResponse(): Build reference list response (apps/web/src/git/protocol.ts:322)buildFetchResponse(): Build packfile response with side-band (apps/web/src/git/protocol.ts:434)
Git operations
apps/web/src/git/service.ts
Provides Git operations using isomorphic-git:
listRefs(): List all references with OIDs (service.ts:33)findCommonCommits(): Find commits client already has (service.ts:324)collectObjectsForPack(): Walk object graph to collect objects (service.ts:213)packObjects(): Create packfile from object list (service.ts:297)
Error responses
Unauthorized access
Pack operation failure
Unsupported command
Related endpoints
Git Protocol Overview
Learn about the Git Smart HTTP Protocol implementation
git-receive-pack
Push operations endpoint