{"thread":{"id":"54315","subject":"Git remote return custom error messages","startedAt":"2020-09-27T22:27:11Z","lastAt":"2020-09-27T23:29:38Z","messageCount":2,"participants":["Hampton Moore","brian m. carlson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"406517","messageId":"CAOefx6Ro6ixiccDq_xH-UsjNWTcjKy=YQfCs7b0ZQkLjSb-0zQ@mail.gmail.com","threadId":"54315","inReplyTo":null,"subject":"Git remote return custom error messages","fromName":"Hampton Moore","fromEmail":"hamptonm@usc.edu","sentAt":"2020-09-27T22:26:56Z","receivedAt":"2020-09-27T22:27:11Z","isPatch":false,"sender":{"key":"hamptonm@usc.edu","avatar":null},"body":"Hello,\nI have a custom ssh server that is handling validating users\npermissions, is there a way for me to return custom text back to the\ngit client that's running push and pull? When I just send an error\nlike \"NOT A DOMAIN\" through STOUT the git client displays \"fatal:\nprotocol error: bad line length character: NOT\". I looked and could\nnot find any obvious documentation on how I could do this, or if it\nwould even be possible. Does anyone have any ideas?\n\nThank you,\nHampton Moore\n"},{"id":"406518","messageId":"20200927232859.GF1392312@camp.crustytoothpaste.net","threadId":"54315","inReplyTo":"CAOefx6Ro6ixiccDq_xH-UsjNWTcjKy=YQfCs7b0ZQkLjSb-0zQ@mail.gmail.com","subject":"Re: Git remote return custom error messages","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-09-27T23:28:59Z","receivedAt":"2020-09-27T23:29:38Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2020-09-27 at 22:26:56, Hampton Moore wrote:\n> Hello,\n> I have a custom ssh server that is handling validating users\n> permissions, is there a way for me to return custom text back to the\n> git client that's running push and pull? When I just send an error\n> like \"NOT A DOMAIN\" through STOUT the git client displays \"fatal:\n> protocol error: bad line length character: NOT\". I looked and could\n> not find any obvious documentation on how I could do this, or if it\n> would even be possible. Does anyone have any ideas?\n\nYou haven't specified at what stage you're thinking about sending this\nresult, so it's not 100% clear what the right answer is, but depending\non the stage, you could try two things.\n\nFirst, you can try sending an error packet:\n\n  error-line     =  PKT-LINE(\"ERR\" SP explanation-text)\n\nThat would usually be displayed to the user and it will be fatal.  If\nyou're in the middle of the protocol, and this is non-fatal, you can try\nusing standard error, since that's usually hooked up to the terminal via\nthe sideband.  It's possible some very old Git versions won't support\nthat, though.\n-- \nbrian m. carlson: Houston, Texas, US\n"}]}