Gitosis and www-data

血红的双手。 提交于 2019-12-11 07:28:47

问题


I'm currently building a ubuntu (10.0.4 LTS) server on a VPS to host a WordPress based website.

I've got gitosis installed to host the remote repository and what I would like to do is plugin to the post receive hook to update the WordPress theme when I git push.

I'm getting a bit confused with users and permissions. As when we I run git pull the files in /var/www will be owned by the git user. Ideally I would like all files in the /var/www to be owned by the same user as I think this would be safer?

I've currently got the /var/www folder owned my the www-data user, after some reading I've realised this is not the best thing to do. I need a bit of help working out the best plan of action for this?


回答1:


From the comments:

I wouldn't use gitosis for that kind of fine-grained control:

  • gitosis is obsolete and not moving since 2009 (even though some forks are still a bit active)
  • This comment and that question illustrate that most features are easier to do with Gitolite.

So, with Gitolite:

The umask use for the Git repo checked out by the git user within a gitolite environment will be the one described in the doc section "most often used/changed variables"

The default UMASK that gitolite uses makes all the repos and their contents have rwx------ permissions. People who want to run gitweb realise that this will not do.

The correct way to deal with this is to give this variable a value like 0027 (note the syntax: the leading 0 is required), and then make the user running the webserver (apache, www-data, whatever) a member of the 'git' group.

If you've already installed gitolite then existing files will have to be fixed up manually (for a umask or 0027, that would be chmod -R g+rX).
This is because umask only affects permissions on newly created files, not existing ones.

From there, you can follow "install gitolite under "apache"".



来源:https://stackoverflow.com/questions/9927981/gitosis-and-www-data

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!