Leena
Leena

Reputation: 55

Automatic email each time change is made in GIT repo

I want to know if there is a way I can have an automatic email sent out after a person makes a commit in a git repo. Each time somebody pushes something into the repo, I would like to have an automatic email sent out to an email list I have specified.
Thank you.

Upvotes: 1

Views: 125

Answers (2)

ItayB
ItayB

Reputation: 11337

  1. Please look at my comment (in your question).
  2. Generally, there's git hooks for each operation, such as push, pull etc. You can "register" to those hooks and perform any operation you like (sending an email for example)

EDIT: in your git bare repository, look for the 'hooks' directory (should be in .git/hooks). You might see some commented example there but the idea is that each hook (event) is represented by a script file (the filename telling you which hook it is). In this script file you can do whatever you like. I (for example) used it to trigger my jenkins to start a new build. You can use it for sending an email.

more info: Customizing Git - Git Hooks and 5 Ways to Send Email From Linux Command Line

If it solved your problem please accept this answer ;-)

Upvotes: 1

MrWebill
MrWebill

Reputation: 37

I point you to this tutorial where they go into detail on setting up an email list to be notified on git changes http://www.systutorials.com/1473/setting-up-git-commit-email-notification/

Upvotes: 1

Related Questions