我有一个 git 钩子(Hook),“commit-msg”
它看起来像:
#!/bin/sh
python .git/hooks/Foo.py
在我的 Foo.py 中
我有:
import git
# doing some stuff based on git (evaluating latest changes)
当我使用 sourcetree 提交时,如果运行钩子(Hook)失败(它也不会提交)
//...
Traceback (most recent call last):
File ".git/hooks/Foo.py", line 2, in <module>
import git
ImportError: No module named git
//...
但如果我直接从终端提交, Hook 会按预期工作。
有什么建议可以修复源代码树上的提交吗?
请您参考如下方法:
