Subject: Re: Detecting source of a push in a pre-receive hook

From: Jeff King <[email-masked]>
Date: Wed, 21 Jan 2026 00:31:53 -0500

On Wed, Jan 21, 2026 at 12:27:05AM -0500, Jeff King wrote:

> But the protocol layer that does that hooking up sometimes leaves
> information in the environment. If clients are connecting over ssh, for
> example, then you'll probably have an $SSH_CLIENT variable set. For
> HTTP, you'd probably get $REMOTE_ADDR, I think.

BTW, one easy way to investigate this is to just put:

  env >&2

into your pre-receive, and then try a push. We forward stderr from the
hook back to the client, so you can see what the server has available in
the environment.

-Peff