(This occurred to me after suggesting the long version with the environment variables—git commit wants to set both an author and a committer, and --author
only overrides the former.)
All git commands take -c
arguments before the action verb to set temporary configuration data, so that’s the perfect place for this:
git -c user.name="Paul Draper" -c user.email="[email protected]" commit -m '...'
So in this case -c
is part of the git
command, not the commit
subcommand.