简体   繁体   中英

Git pull to www folder after git push

I would like to pull code to virtual host directory from GIT after a push. The problem is that commit hook runs as git user but the folder of virtual directory on apache is under 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?

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.

I'd recommend that you have a cron job run a git pull every few minutes instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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