Automatically changes `git config` based on path 🚀
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


MIT License GitHub tag Build Status

Automatically changes git config based on path

Working on projects for multiple organizations? This git hook changes your email address as necessary in the git config local to the current repository before commit.


Getting started

Clone with git clone Then cd git-multi-email.

Ensure you have a core hooks directory (ex: ~/.git-config/hooks/). If not, use mkdir -p ~/.git-config/hooks/ to create it and use git config --global core.hooksPath ~/.git-config/hooks/ to configure that directory as your hooks path.

git config --global core.hooksPath ~/.git-config/hooks/

Then, use these commands to copy the hook to the global hooks folder:

  • cp ./post-commit ~/.git-config/hooks/post-commit
  • chmod a+x ~/.git-config/hooks/post-commit
  • mkdir ~/.git-config/hooks/vendor/
  • cp ./vendor/ ~/.git-config/hooks/vendor/

Next, configure your ~/.gitconfig file...


Update your ~/.gitconfig file to include a new section called [emails]. Example configuration file:

	name = Noah Bass
	email =
	astronomerio =
	acmatuc =

So now, any commit made in a repo within a folder named astronomerio will use as the email address. Similarly, any commit made in a repo within a folder named acmatuc will use as the email address. Otherwise, commits will use the default as the email address.

(Remember that the .gitconfig file follows the INI format)


  • Requires Git v2.9.0 or later
  • Not tested on Windows

Hacking on git-multi-email



Run tests with Docker! Use docker build -t git-multi-email-test . --no-cache --rm to build the image, then docker run --rm git-multi-email-test to run the tests.

Or, you can choose to run the tests without Docker by using sh ./test/, then sh ./test/

Note: tests running on Travis CI use Docker.


MIT License