From: Jeff King <peff@peff.net>
To: Chris Packham <judge.packham@gmail.com>
Cc: GIT <git@vger.kernel.org>
Subject: Re: Detecting source of a push in a pre-receive hook
Date: Wed, 21 Jan 2026 00:31:53 -0500 [thread overview]
Message-ID: <20260121053153.GA567894@coredump.intra.peff.net> (raw)
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
prev parent reply other threads:[~2026-01-21 5:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAFOYHZDnXQOcDmzwf1WRpZpNRAs-R2YOBh3ru0mr0ffrMLB=9Q@mail.gmail.com>
2026-01-20 20:45 ` Detecting source of a push in a pre-receive hook Chris Packham
2026-01-20 21:57 ` rsbecker
2026-01-21 5:27 ` Jeff King
2026-01-21 5:31 ` Jeff King [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260121053153.GA567894@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=judge.packham@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox