开发者

Deploy with git pull on webserver on /var/www/vhosts

开发者 https://www.devze.com 2023-02-22 07:17 出处:网络
Can I create with git files owned by root without using root to push? I use git user to push on the webserver. But /var/www is owned by root or www-data with no write access for other user.

Can I create with git files owned by root without using root to push?

I use git user to push on the webserver. But /var/www is owned by root or www-data with no write access for other user.

I can pull in an other directory and use "hook/post-receive" but stil开发者_JAVA百科l this hook is executed with the git user...

For the moment I log in the webserver and do a sudo git pull origin. But it will be more efficient if I was hable to do a git pull server from my laptop.

Thanks


Just putting my comment here as answer, since as far as I know, it will completely fix the problem:

Make a symlink in /var/www to a map owned by the git user (e.g. /home/git/www). Then push your files to this /home/git/www map. No problems with permissions anymore.


My solution was to give all files to git by way of the www-pub group with read permission for everyone—except settings files with the MySQL password.

I push to /home/git/repository/project and checkout to /var/www/project using hook/post-receive.

0

精彩评论

暂无评论...
验证码 换一张
取 消