gitolite和文件权限 [英] gitolite and file permissions
问题描述
我在Ubuntu服务器上设置了一个gitolite repo,这个服务器旨在让开发人员克隆/推送我们将要开发的项目。我在回购后收到挂钩信息时遇到问题。我有一个post-receive钩子,在特定的repo中查看服务器上的特定目录,在我的情况下是/ home / user / www / projects /。问题是,当一个管理员推回一个回购(git push origin)时,钩子将项目成功检出到指定的目录,并更改正在检出的目录(项目)的权限。但是,如果普通用户推入回购站,那么挂钩会在不更改权限的情况下完整检查项目。我已经在服务器上检查了0002的umask,这不应该成为问题。
I have set up a gitolite repo on a ubuntu server which is intended to have developers clone/push projects we will be working on. I'm having a problem with the post-receive hook I have in a repo. I have a post-receive hook in a particular repo checking out to a particular directory on the server, in my case is /home/user/www/projects/. The problem is When an admin pushes a repo (git push origin), the hook checks out the project to the specified directory successfully and changes the permissions on the directory (project) being checked out. However, if a regular user pushes to the repo, then the the hooks checks out the project intact without changing permissions. I already checked umask on the server which is 0002 and it shouldn't be the issue here. I'm uninstalled and reinstalled gitolite but still having the same issue.
推荐答案
正如尝试CHMOD post-receive hook ,与Git仓库相关的权限本身可能很重要。
As explained in "Git CHMOD post-receive hook", the permission associated with the Git repo itself could matter here.
在Gitolite中,该权限是在 .gitolite.rc
作为 $ REPO_UMASK
$ UMASK
(这是' $ UMASK
'与 GitoliteV3或'g3'现在)。
检查是否影响您的结帐问题:
In Gitolite, that permission is configure in the .gitolite.rc
as $REPO_UMASK
$UMASK
(It is '$UMASK
' with GitoliteV3 or'g3' now).
Check if that does influence your checkout issue:
gitolite使用的默认
UMASK
使所有repos及其内容具有rwx ------
权限。想要运行gitweb
的人会意识到这是行不通的。
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.
解决这个问题的正确方法是给这个变量赋值如 0027
(注意语法:需要前导 0
),然后让用户运行web服务器(apache,www-data,不管)是 git
组的成员。
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.
你已经安装了gitolite,那么现有的文件将不得不手动解决(对于 umask
或 0027
),那会是 chmod -R g + rX
)。
这是因为 umask
只影响权限在新创建的文件上,不存在。
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.
这篇关于gitolite和文件权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!