Re: Detecting source of a push in a pre-receive hook
- From
Jeff King <peff@peff.net>
- Date
- Jan 21, 2026, 05:31 UTC
- Message-ID
- <20260121053153.GA567894@coredump.intra.peff.net>
- In-Reply-To
- <20260121052705.GA567009@coredump.intra.peff.net>
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