There is a nice stackoverflow posting about how to set the sender of git post-receive hooks. I used this, slightly augmented:
# Use the name and email address of the author of the last commit.
USER_EMAIL=$(git log -1 --format=format:%ae HEAD)
USER_NAME=$(git log -1 --format=format:%an HEAD)
. $(dirname $0)/post-receive-email
I then also changed the default post-receive-email script, to look like this in the send_mail() function:
if [ -n "$envelopesender" ]; then
/usr/sbin/sendmail -t -f "$envelopesender"
/usr/sbin/sendmail -t -F "$USER_NAME" -f "$USER_EMAIL"
This will let the emails come from the last user in the git log. This is only a hack, and might break or not make sense under certain circumstances, but is good enough for most of my needs.