Git post接收挂钩无法运行worktree

Git post接收挂钩无法运行worktree,git,shell,tree,hook,git-post-receive,Git,Shell,Tree,Hook,Git Post Receive,我已经在服务器上设置了裸git存储库,我想添加post接收钩子,它将目录添加为工作树并在那里签出主分支。问题是,每次我推送我的更改并执行钩子时,我都会得到一个错误: remote: git: 'worktree' is not a git command. See 'git --help'. hooks/post接收文件的内容为: git worktree add -f /some/existing/folder/on/server master 当我从shell中运行相同的命令时,它工作正

我已经在服务器上设置了裸git存储库,我想添加post接收钩子,它将目录添加为工作树并在那里签出主分支。问题是,每次我推送我的更改并执行钩子时,我都会得到一个错误:

remote: git: 'worktree' is not a git command. See 'git --help'.
hooks/post接收文件的内容为:

git worktree add -f /some/existing/folder/on/server master
当我从shell中运行相同的命令时,它工作正常,并且在指定的目录中添加/更新文件。 服务器上的Git是2.6.1

有人有线索吗

谢谢