git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Git remote return custom error messages

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Sep 27, 2020, 23:28 UTC
Message-ID
<20200927232859.GF1392312@camp.crustytoothpaste.net>
In-Reply-To
<CAOefx6Ro6ixiccDq_xH-UsjNWTcjKy=YQfCs7b0ZQkLjSb-0zQ@mail.gmail.com>
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
Previous: Hampton Moore
Message 2 of 2 in “Git remote return custom error messages”
  1. Hampton MooreSep 27, 2020
  2. brian m. carlsonSep 27, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.