server receive-pack: side-band-64k and atomic not supported, breaks native git push over smart HTTP
Summary
When implementing a Git smart HTTP server with plumbing/transport/server, native git push fails if the server advertises common receive-pack capabilities (side-band-64k, atomic) and then handles the push with go-git's receive-pack session.
The request decodes successfully, but ReceivePack returns:
unsupported capability: side-band-64k
The git client then reports:
error: RPC failed; HTTP 500
send-pack: unexpected disconnect while reading sideband packet
fatal: the remote end hung up unexpectedly
go-git version
github.com/go-git/go-git/v5 v5.19.1
Root cause
rpSession.setSupportedCapabilities only advertises/supports:
agentofs-deltadelete-refsreport-status
However, smart HTTP servers commonly advertise additional receive-pack capabilities that native git clients will use when present, including:
side-band-64katomic
Upload-pack on the server side already supports sideband capabilities (upSession.setSupportedCapabilities sets Sideband and Sideband64k), but receive-pack does not.
Expected behavior
A go-git HTTP/git server should be able to:
- Advertise standard receive-pack capabilities used by native git clients
- Accept a native
git pushover smart HTTP stateless RPC - Return a valid report-status response (including sideband encoding when negotiated)
Actual behavior
- If the server advertises
side-band-64k, nativegit pushfails withunsupported capability: side-band-64k - If the server advertises only the capabilities currently supported by
rpSession, nativegit pushsucceeds and refs are updated correctly
So decode/unpack/ref-update works; the blocker is capability negotiation and response encoding for sideband.
Minimal reproduction
- Create an empty bare repo and a local repo with one commit
- Run an HTTP test server:
GET /repo.git/info/refs?service=git-receive-packadvertises refs with capabilities includingside-band-64kandatomicPOST /repo.git/git-receive-packpipes the body to go-gitReferenceUpdateRequest.Decode+server.ReceivePackSession.ReceivePack
- Run:
git -C <source> push http://127.0.0.1:<port>/repo.git HEAD:refs/heads/main - Observe HTTP 500 and
unsupported capability: side-band-64k
If step 2 advertises only report-status, delete-refs, ofs-delta, and agent, the same flow succeeds.
Workaround
Delegate receive-pack to native git:
exec.Command("git", "receive-pack", "--stateless-rpc", ".").Run()
Environment
- macOS
- system
gitclient (native push) - go-git server path via
plumbing/transport/server
Additional context
We are building a Git hosting server and would like to avoid shelling out to the git binary for push. Upload-pack is already handled in pure Go; receive-pack is the remaining blocker.
After I remove side-band-64k and atomic, it still report error when pushing commits or tags. Now I switch to git binary to solve this.
I've been looking into server-side atomic push support on main.
Since ReferenceStorer doesn't provide transactions, would an implementation that validates all ref updates first and rolls back previously applied updates on failure be acceptable?
The main limitation is that rollback cannot guarantee strict atomicity if another writer modifies the refs concurrently or a rollback operation itself fails.
Would you prefer this approach, or should atomic push support require a transactional storage interface?