我想使用git-multimail作为git存储库中的post receive钩子(没有使用gitolite)。不幸的是,我不能让它工作,而且我几乎没有任何使用Python的经验。在
project.git/config
文件中:在
[multimailhook]
mailingList = email@example.com
from = email@example.com
envelopeSender = email@example.com
mailer = smtp
smtpServer = smtp.mydomain.com
smtpUser = myUser
smtpPass = myPassword
请注意,我不知道在mailer
变量中定义的“smtp”是否安装在我的机器上。在
git_multimail.py
文件复制到project.git/hooks
。在project.git/hook/post-receive
文件。文件是可执行的,我是从https://github.com/git-multimail/git-multimail/blob/master/git-multimail/post-receive.example复制的在
^{pr2}$当我推送更改时,会创建一个文件project.git/hooks/git_multimail.pyc
,但不会发送电子邮件。在
使用GIT_MULTIMAIL_CHECK_SETUP=true python git_multimail.py
进行配置测试,如https://github.com/git-multimail/git-multimail/blob/master/doc/troubleshooting.rst所述,告诉我git-multimail seems properly set up
有没有一种方法可以记录脚本的输出?我该怎么做才能找出什么不起作用?我的文件甚至有错误吗?在
提前谢谢。在
好吧,伙计们,错误可能是最小的。我在post receive hook文件中只犯了一个非常小的错误:
sys.exit(1)
命令没有缩进。在所以,从我的问题来看是错误的:
正确的是(比较最后一行):
^{pr2}$就像我说的,我几乎不懂Python,所以我没有注意到缩进。在更正了这一点之后,电子邮件就被发送了,所以您可以使用上面的步骤作为一个小教程来设置git multimail,这是“最简单”的方法。(我没有找到关于这个精确解决方案的教程。)
到目前为止,使用}:作为post头的最简单方法-示例.receive脚本上写着:
post-receive.example
并不是设置{换句话说,只是
你已经准备好了(因为你已经填写了
project.git/config
)。有关更多详细信息,请参见Invocation in git-multimail's README。在(注:令人钦佩的是,对于初学者来说,doc不是很清楚,I'll try to improve that when I get time)
相关问题 更多 >
编程相关推荐