背景:
我在服务器上设置了后接收器挂钩裸露repo
-rwxrwxr-x 1 midnight midnight 58 Jan 24 19:45 post-receive
$ cat post-receive
GIT_WORK_TREE = /var/www/mongo_conprima git checkout -f
/var/www/mongo_conprima
的文件许可
drwxr-xr-x 3 midnight midnight 4096 Jan 25 08:40 mongo_conprima
Porblem 从本地主机推动时,我会出现以下错误
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 228 bytes, done.
Total 2 (delta 1), reused 0 (delta 0)
remote: hooks/post-receive: 1: hooks/post-receive: GIT_WORK_TREE: not found
我想在每次推送服务器[问题]之后更新生产目录:git Hook以更新工作目录和Bare Git目录的更改
您拥有的是shell-script语法问题,而不是git问题。
在外壳脚本中:
a b c
使用参数b
和c
运行命令a
。即使您将b
替换为=
,这也是正确的,该CC_5只能使用参数=
和c
运行命令a
。因此,这试图使用参数=
,/var/www/mongo_conprima_a
,git
,checkout
和-f
运行命令GIT_WORK_TREE
(按照此顺序)。
用于设置环境变量的shell脚本语法,然后运行命令是:
VAR=value cmd args...
简而