【发布时间】:2013-10-20 16:24:18
【问题描述】:
在遵循本指南 http://toroid.org/ams/git-website-howto 之后,我正在使用 Git 维护多个网站
我对本地存储库进行更改并提交 然后我 git push 到我服务器上的远程存储库 在钩子/接收后我这样做:
#! /bin/sh
GIT_WORK_TREE=/home/user/public_html/ git checkout -f
这很好用,除了我通过 ssh 以 root 身份推送,所以所有签出的文件都归 root:root 所有。这会导致权限问题。
我目前使用的解决方案是在 post-receive 文件中添加一行,例如:
chown -R user:user /home/user/public_html/*
这很好用,除了将 public_html 中的所有文件设置为 user:user 的明显问题之外,这不一定是想要的,而且可能有点效率低下。它还引入了另一个输入 user:user 错误的机会。
所以:
有没有办法只设置正在签出的文件而不是public_html中的所有文件?
有没有办法阻止文件被 root:root 拥有?我必须以 root 身份登录,因为我不想给其他用户 ssh 访问权限。
【问题讨论】:
-
你不想给其他用户ssh访问权限,但是你给了root权限? oO
-
不,只有我有root权限