为什么我的post-receive hook不能运行virtualenv源命令?

wil*_*low 4 python linux git virtualenv git-post-receive

我有一个以用户'git'运行的post-receive钩子.我有一个可以被git读取的virtualenv/python/ve // bin/activate.运行:

source /python/ve/<name>/bin/activate
Run Code Online (Sandbox Code Playgroud)

适用于git组中的用户.

当它在推送后作为post-receive挂钩运行时,我收到错误"source:not found".

我不确定在哪里可以看到 - 任何提示都非常赞赏.

Mar*_*air 11

这是一个猜测,因为你没有引用你的完整post-receive钩子,但我怀疑你没有指向顶部的shebang线/bin/bash.你的post-receive钩子应该开始:

#!/bin/bash
Run Code Online (Sandbox Code Playgroud)

我怀疑这是因为如果我运行严格的Bourne shell,就像dash在尝试使用任何内容时遇到同样的错误source.