Setup an email notification on git commit

We will setup a git template so when you create a new git repository with “git init –bar project-name.git”, it will copy what you have in your git template directory.

  1. git config --global init.templatedir '~/.git-templates'
  2.  mkdir -p ~/.git-templates/hooks
  3. vim config and add this content and update the email addresses. It will be copied to your config file ever time you create a new git repository.
  4. vim descriptionand add your subject line “Git commit received on [project name]”.
  5. cd hooks
  6. vim post-commit
  7. Add the script from REF 1

[hooks]
mailinglist = "email1@example.com email2@example.com"
senderemail = "owner@exmaple.com"

You are all set.
REFERENCES
https://www.systutorials.com/1473/setting-up-git-commit-email-notification/
https://coderwall.com/p/jp7d5q/create-a-global-git-commit-hook