Summary
The git remote helper discards the HTTP response body on a failed push, so the server's descriptive error never reaches the user. crates/git-remote-gitlawb/src/main.rs:297:
if !pack_resp.status().is_success() {
bail!("POST /{} returned {}", service, pack_resp.status());
}
It reports only the status line. The JSON body (which carries the message field, e.g. the owner-push rejection "push rejected — only the repo owner may push to this repository (GITLAWB_ENFORCE_OWNER_PUSH is enabled)") is dropped.
Impact
On any non-2xx receive-pack response the user sees POST /git-receive-pack returned 403 Forbidden and nothing about why. This is pre-existing and affects every push error path, not one feature. It became more visible with the owner-push enforcement landed in #68, which returns a 403 whose body explains the rejection and what to do, none of which currently surfaces.
The same pattern is on the fetch path at main.rs:210-213 (GET /info/refs), worth fixing together.
Suggested fix
Read the body before bailing and include it when present:
if !pack_resp.status().is_success() {
let status = pack_resp.status();
let body = pack_resp.text().await.unwrap_or_default();
if body.is_empty() {
bail!("POST /{service} returned {status}");
}
bail!("POST /{service} returned {status}: {body}");
}
AppError serializes as {"error":"<code>","message":"..."}, so surfacing the raw body is already useful; extracting message for a cleaner line is optional.
Scope
Pre-existing, not a regression from #68. Localized to the remote helper.
Summary
The git remote helper discards the HTTP response body on a failed push, so the server's descriptive error never reaches the user.
crates/git-remote-gitlawb/src/main.rs:297:It reports only the status line. The JSON body (which carries the
messagefield, e.g. the owner-push rejection"push rejected — only the repo owner may push to this repository (GITLAWB_ENFORCE_OWNER_PUSH is enabled)") is dropped.Impact
On any non-2xx receive-pack response the user sees
POST /git-receive-pack returned 403 Forbiddenand nothing about why. This is pre-existing and affects every push error path, not one feature. It became more visible with the owner-push enforcement landed in #68, which returns a 403 whose body explains the rejection and what to do, none of which currently surfaces.The same pattern is on the fetch path at
main.rs:210-213(GET /info/refs), worth fixing together.Suggested fix
Read the body before bailing and include it when present:
AppErrorserializes as{"error":"<code>","message":"..."}, so surfacing the raw body is already useful; extractingmessagefor a cleaner line is optional.Scope
Pre-existing, not a regression from #68. Localized to the remote helper.