请问大家有没有用 Git 来 depoly php application 呢?
我在 permission 的问题上很纠结……
我的理想设定如下:
假设:
~mysite/www/ - production, web server run as "nobody"
/var/git/site.git - remote repo
方案1:Git hook
每当有人 push 到 remote repo 的时候,自动 cd 到 production 然后 git pull 一下
这个可以用 git hook 来达成,只是我在用 ssh,生成的档案都不是 nobody 而是上传者。user 甚至打开不了 ~mysite/www/ 这个 folder
方案2:Cronjob
我写了如下 job,每分钟执行一次,唯未见成效,也不知道如何 debug ...
*/1 * * * * su -s /bin/sh nobody -c 'cd ~mysite/www && git pull -q'
如何是好?
我现在都是用 setfacl 和登入 ssh 手动做 git pull 的,很蠢…
我在 permission 的问题上很纠结……
我的理想设定如下:
假设:
~mysite/www/ - production, web server run as "nobody"
/var/git/site.git - remote repo
方案1:Git hook
每当有人 push 到 remote repo 的时候,自动 cd 到 production 然后 git pull 一下
这个可以用 git hook 来达成,只是我在用 ssh,生成的档案都不是 nobody 而是上传者。user 甚至打开不了 ~mysite/www/ 这个 folder
方案2:Cronjob
我写了如下 job,每分钟执行一次,唯未见成效,也不知道如何 debug ...
*/1 * * * * su -s /bin/sh nobody -c 'cd ~mysite/www && git pull -q'
如何是好?
我现在都是用 setfacl 和登入 ssh 手动做 git pull 的,很蠢…