Lin Ma
Lin Ma

Reputation: 10139

how to notify other users when git commit or push

I am not using any review tools (e.g. pull request), and just want to email notify the whole team if anyone is executing git commit or git push (notification is just for their information purpose, no need for their review). Wondering if any solutions either from either git command line or github.com setup.

Upvotes: 12

Views: 11351

Answers (2)

Ras
Ras

Reputation: 21

I'll assume you wish to monitor pushes to remote (I have a solution for local as well at the end) and for that you can use GitHub webhooks as mentioned in @poke's response.

Just to give an alternate answer for anyone else looking to try it out. If you rather not build your own consumption pipeline, consider using LightFlare (I'm the creator) that has out of the box support of consuming Webhooks events from many services (github included) and notifies you at your choice(s) of destinations (slack / email etc ...).

LightFlare currently supports monitoring on services like:

  • Infra: GCP, AWS, Azure, heroku
  • Code/release: GitHub, bitbucket, netlify
  • Commerce: shopify, gumroad
  • More integrations based on our customers asks

With LightFlare, you can track local commits as well .. just have to add a git hook that curl's to your lightflare channel URL.

Upvotes: 2

poke
poke

Reputation: 387547

GitHub includes a built-in webhook to send emails for pushes in a repository. You can set that up from the “Webhooks & services” configuration of a repository. See this official manual for more details.

In addition, you could set up your own webhooks to send out notifications. As for notifications on committing, you could do that too using normal Git hooks, but since commits happen locally (and offline), every member of your team would be required to set up that Git hook and also agree to send out emails automatically whenever they commit. I personally wouldn’t want that at all. It’s a strong feature that you are able to push only when you are ready with your commits, so you shouldn’t take that away from users (and I personally commit a lot more often than my final history shows—those commits are not meant for others but only for me).

Upvotes: 10

Related Questions