Re: Git remote return custom error messages
On 2020-09-27 at 22:26:56, Hampton Moore wrote:
Show 8 quoted lines
> Hello,
> I have a custom ssh server that is handling validating users
> permissions, is there a way for me to return custom text back to the
> git client that's running push and pull? When I just send an error
> like "NOT A DOMAIN" through STOUT the git client displays "fatal:
> protocol error: bad line length character: NOT". I looked and could
> not find any obvious documentation on how I could do this, or if it
> would even be possible. Does anyone have any ideas?
You haven't specified at what stage you're thinking about sending this result, so it's not 100% clear what the right answer is, but depending on the stage, you could try two things.
First, you can try sending an error packet:
error-line = PKT-LINE("ERR" SP explanation-text)That would usually be displayed to the user and it will be fatal. If you're in the middle of the protocol, and this is non-fatal, you can try using standard error, since that's usually hooked up to the terminal via the sideband. It's possible some very old Git versions won't support that, though.
--
brian m. carlson: Houston, Texas, US