Git: Set local and different for each repo


I'm currently working on 2 projects, which expect that I configure my local username and email with different data when I push to them. For that I'm updating my config all the time like:

git config --local "[email protected]"

Since they are different repositories, is there a way I could define an local email for each repository?

Maybe in the .gitconfig?


For just one repo, go into to the relevant repo DIR and:

git config "Your Name Here"
git config [email protected]

For (global) default email (which is configured in your ~/.gitconfig):

git config --global "Your Name Here"
git config --global [email protected]

You can check your Git settings with: git config && git config

If you are in a specific repo which you setup a new user/config for (different to global) then it should show that local config, otherwise it will show your global config.

What does git push -u mean?

How to cancel a local git commit?