我目前正在 VPS 上构建一个 ubuntu(10.0.4 LTS)服务器来托管一个基于 WordPress 的网站。
我已经安装了 gitosis 来托管远程存储库,我想做的是插入 post receive
当我 git push
时 Hook 更新 WordPress 主题.
我对用户和权限有点困惑。当我们运行 git pull
时/var/www
中的文件将归 git 用户所有。理想情况下,我希望 /var/www
中的所有文件由同一个用户拥有,因为我认为这会更安全?
我目前有 /var/www
文件夹拥有我的 www-data 用户,经过一番阅读后,我意识到这不是最好的做法。我需要一些帮助来制定最好的行动计划吗?
最佳答案
从评论:
我不会将 gitosis 用于那种细粒度的控制:
因此,使用 Gitolite:
umask
git 用户在 gitolite 环境中 checkout 的 Git 存储库的使用将在文档部分“most often used/changed variables”中描述The default
UMASK
that gitolite uses makes all the repos and their contents haverwx------
permissions. People who want to rungitweb
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 leading0
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
or0027
, that would bechmod -R g+rX
).
This is becauseumask
only affects permissions on newly created files, not existing ones.
从那里,您可以关注“install gitolite under "apache"”。
关于ubuntu - Gitosis 和 www 数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9927981/