Search code examples
githttpenvironment-variablesgit-pushauthor

git-http-backend - override commit author name


here is my test CGI script :

#!/bin/bash

echo "$(date) - REQUEST_METHOD[$REQUEST_METHOD] \
GIT_COMMITTER_NAME[$GIT_COMMITTER_NAME] \
GIT_COMMITTER_EMAIL[$GIT_COMMITTER_EMAIL] \
REMOTE_USER[$REMOTE_USER] \
GIT_AUTHOR_NAME[$GIT_AUTHOR_NAME] \
GIT_AUTHOR_EMAIL[$GIT_AUTHOR_EMAIL]" >> /tmp/git_cgi_test.log

/usr/lib/git-core/git-http-backend

"git push" output in /tmp/git_cgi_test.log :

Thu Jul  7 11:07:28 CEST 2016 - REQUEST_METHOD[GET] GIT_COMMITTER_NAME[foo] GIT_COMMITTER_EMAIL[[email protected]] REMOTE_USER[auth_basic_user] GIT_AUTHOR_NAME[bar] GIT_AUTHOR_EMAIL[[email protected]]
Thu Jul  7 11:07:28 CEST 2016 - REQUEST_METHOD[POST] GIT_COMMITTER_NAME[foo] GIT_COMMITTER_EMAIL[[email protected]] REMOTE_USER[auth_basic_user] GIT_AUTHOR_NAME[bar] GIT_AUTHOR_EMAIL[[email protected]]

=> seems web server environnement variables set and visible in CGI script.

"git log" on bare git repo :

commit 688a98573c5a7559d0fdfb7ff823add3ba0e3a17
Author: remote_os_user <remote_os_user@remote_os_hostname>
Date:   Thu Jul 7 11:07:22 2016 +0200

    the commit comment
...

=> neither "foo" nor "bar" nor "auth_basic_user", but "remote_os_user" :(

==> what environnement variables must be set for git-http-backend to override the author name in the final bare git repo ?

(I dont control the user.name or user.email on remote contributors laptops. I need the override on the server side)


Solution

  • I'd like that, too, but it's not possible to change the commits (without corrupting them) when pushed on your central git repository. See this discussion.