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

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
Previous: Jeff King
Message 4 of 4 in “Detecting source of a push in a pre-receive hook”
  1. Chris PackhamJan 20, 2026
  2. rsbecker@nexbridge.comJan 20, 2026
  3. Jeff KingJan 21, 2026
  4. Jeff KingJan 21, 2026

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.