# Git remote return custom error messages

2 messages from 2020-09-27 to 2020-09-27. Participants: Hampton Moore, brian m. carlson.
Thread: https://gitlist.dev/t/54315

## Hampton Moore, 2020-09-27 22:26

Subject: Git remote return custom error messages
Message-ID: <CAOefx6Ro6ixiccDq_xH-UsjNWTcjKy=YQfCs7b0ZQkLjSb-0zQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAOefx6Ro6ixiccDq_xH-UsjNWTcjKy%3DYQfCs7b0ZQkLjSb-0zQ%40mail.gmail.com

```
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?

Thank you,
Hampton Moore

```

## brian m. carlson, 2020-09-27 23:28

Subject: Re: Git remote return custom error messages
Message-ID: <20200927232859.GF1392312@camp.crustytoothpaste.net>
URL: https://gitlist.dev/e/20200927232859.GF1392312%40camp.crustytoothpaste.net
In-Reply-To: <CAOefx6Ro6ixiccDq_xH-UsjNWTcjKy=YQfCs7b0ZQkLjSb-0zQ@mail.gmail.com>

```
On 2020-09-27 at 22:26:56, Hampton Moore wrote:
> 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

```
