loading...

How to set different defaults for author and committer at git

igorsantos07 profile image Igor Santos ・1 min read

Me, looking for a way to set different author and committer on Google: nowhere to be found
Me, looking for a way to set different author and committer on Google: nowhere to be found. Sad Igor was sad.

I wanted to have a default Committer that’s different from my default Author, as I need to differentiate commits made from my local and testing environments.

This is not as straight-forward as setting name/email at git, as there are no separate configuration entries for author and committer. However, it’s still possible if you override some environment variables, as follows: 
Example (at your ~/.bashrc or ~/.bash_profile):

GIT_COMMITTER_NAME=”Deploy server”
GIT_COMMITTER_EMAIL=”deploy@server.dev”

In case you’ve forgotten/don’t know, you can set default name/user for git commits by editing ~/.gitconfig or running commands like these:

$ git config — global user.name “Igor Santos”
$ git config — global user.email “igor.santos@example.com”

Posted on by:

igorsantos07 profile

Igor Santos

@igorsantos07

Remote developer with ~10 years of experience. Mostly worked with PHP and with a passion for REST APIs and front-end interfaces, UX and DX. I also have a foot on React and Python/Django :)

Discussion

pic
Editor guide