为什么我的post-receive钩子不能运行virtualenv源命令? [英] Why can't my post-receive hook run a virtualenv source command?
问题描述
我有一个以用户'git'运行的post-receive钩子。我有一个可由git读取的virtualenv / python / ve // bin / activate。运行:
source / python / ve /< name> / bin / activate
可以在git群组中使用。
我收到错误source:not found。
我不确定还有什么地方可以看 - 任何提示都非常感谢。
因为你没有引用完整的 post-receive $>,所以这是一种猜测。 c $ c> hook,但我怀疑你没有 shebang line 指向顶部的 / bin / bash
。您应该开始 post-receive
钩子: #!/ bin / bash
我怀疑这是因为如果我运行一个严格的Bourne shell,比如破折号
,当尝试使用 source
来源时,我得到同样的错误。
I have a post-receive hook that is running as user 'git'. I have a virtualenv /python/ve//bin/activate that is readable by git. Running:
source /python/ve/<name>/bin/activate
works fine for a user in the git group.
When it runs as a post-receive hook after a push, I get the error "source: not found".
I'm not sure where else to look - any hints much appreciated.
解决方案 This is something of a guess, since you haven't quoted your complete post-receive
hook, but I suspect that you don't have a shebang line pointing to /bin/bash
at the top. Your post-receive
hook should begin:
#!/bin/bash
I suspect this because if I run a strict Bourne shell, like dash
, I get the same error when trying to source anything with source
.
这篇关于为什么我的post-receive钩子不能运行virtualenv源命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!