Skip to content

Pushes rejected with 403 status message don't render the message at the git client end #1177

@kriswest

Description

@kriswest

Describe the bug
We switched to returning 403 and 500 statuses when rejecting pushes, however git clients don't render the message for these status values. Hence we need to switch back to returning 200 statuses and include comments in the codebase explaining.

When a 403 is returned on reject:

% git push
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 14 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 309 bytes | 309.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0), pack-reused 0
error: RPC failed; HTTP 403 curl 22 The requested URL returned error: 403
send-pack: unexpected disconnect while reading sideband packet
fatal: the remote end hung up unexpectedly
Everything up-to-date

When a 200 is returned on reject:

% git push
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 14 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 309 bytes | 309.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0), pack-reused 0
remote: 	Your push has been blocked (kristopher.west@natwest.com is not allowed to push on repo https://github.com/*****.git)
fatal: the remote end hung up unexpectedly
fatal: the remote end hung up unexpectedly
error: failed to push some refs to 'http://localhost:8000/github.com/*****.git'

The change to the status code returned should be reverted to 200.

Expected behavior
The error message returned is rendered in the user's terminal by the git client.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions