简体   繁体   English

git push后将Git拉到www文件夹

[英]Git pull to www folder after git push

I would like to pull code to virtual host directory from GIT after a push. 我想在推送后将代码从GIT拉到虚拟主机目录。 The problem is that commit hook runs as git user but the folder of virtual directory on apache is under www-data:www-data. 问题是提交挂钩以git用户身份运行,但是apache上的虚拟目录文件夹位于www-data:www-data下。

Is there any possibility to run script as www-data (shell script including git pull and some rm stuff for temp) instead of git user? 是否有可能将脚本作为www-data(shell脚本,包括git pull和一些用于rm的rm脚本)而不是git user运行?

Thanks Martin. 谢谢马丁。

While it is possible using sudo and defining specific commands, I'd recommend against it: This setup sounds easy to misconfigure or break. 虽然使用可能 sudo并确定具体的命令,我会建议反对:此设置听起来很容易错误地配置或断裂。

I'd recommend that you have a cron job run a git pull every few minutes instead. 我建议您有一个cron作业,而不是每隔几分钟运行一次git pull

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM