DEV Community

Igor Santos
Igor Santos

Posted on

4 1

How to set different defaults for author and committer at git

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”
Enter fullscreen mode Exit fullscreen mode

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”
Enter fullscreen mode Exit fullscreen mode

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs