简体   繁体   English

Git电子邮件通知

[英]Git email notification

How to setup email notification for every commit locally or push to the git server? 如何为本地每次提交或推送到git服务器设置电子邮件通知? Detailed description: I want to trigger a mail to group of users for every push to the server. 详细说明:我想为每次推送服务器触发向用户组发送邮件。

Construct a script to create and send emails. 构造一个脚本来创建和发送电子邮件。 I have used this . 我已经用过 Put the script in the post-commit hook locally(to send email notification on every commit) and post-receive hook on the remote (to send email notification on every push). 将脚本放在本地的提交后挂钩中(每次提交时发送电子邮件通知),将接收后的挂钩放在远程上(每次推送时发送电子邮件通知)。

Do not forget to rename post-receive.sample to post-receive and same with post-commit! 不要忘记将post-receive.sample重命名为post-receive,并与post-commit相同!

Happy Gitting! 快乐的礼物!

YOu can put the below code inside post-commit and post-receive hooks. 您可以将以下代码放入提交后和接收后挂钩中。

while read mailadd
do
   echo "This is a test mail" | mail ${mailadd} -s "test mail" -a file.txt
done < mailids.txt

mailids.txt is the file with will have mail IDs. mailids.txt是带有邮件ID的文件。 (one ID in one line). (一行中有一个ID)。

echo "This is a test mail" this is the email body -s "test mail": This is subject -a file.txt : For sending any file as attachment echo“这是一封测试邮件”这是电子邮件正文-s“测试邮件”:这是主题-a file.txt:用于发送任何文件作为附件

git-multimail is meant exactly for that. git-multimail就是为了这个目的。

Warning: I'm the author. 警告:我是作者。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM