We have a production machines with access to it by user1, user2, etc. or example.
And we need to make the preservation authors of commit.
By some time of googling I’ve found the next solution:
First, we create or add to ~/.bashrc of your user on remote machine next enviromnents:
export GIT_AUTHOR_NAME="YourName" export GIT_AUTHOR_EMAIL="YourEmail" export GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME" export GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"
And add the next settings to /etc/sudoers
Defaults env_reset Defaults env_keep += "GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL"
Well, done. Git of course warning you about his not configured variables but author of commit fills completely.
UPD: Removed typo s/COMMITER/COMMITTER/g and git stop warning you (^^,)