在Git / Gitolite中设置umask [英] Setting umask in Git / Gitolite
问题描述
我已经设置了Git和Gitolite,并且在某个时候我回想起在一个配置文件中看到了umask设置。这是否设置了我使用Git同步的所有文件的权限?这正是我需要的。我在哪里可以找到它?
gitolite中的umask设置是否有用于更改新创建的回购站的umask(而不是关于这些回购版管理的文件)。
查看 gitolite.rc文档:
$ REPO_UMASK
,八进制,默认0077
gitolite使用的默认
UMASK
使所有repos及其内容具有rwx ------
权限。希望运行gitweb的人意识到这是行不通的。
解决这个问题的正确方法是给这个变量赋值,如
0027
(注意语法:需要前导0),然后让用户运行webserver(apache,www-data
,无论)a如果您已经安装了gitolite,那么现有的文件将不得不手动解决(对于umask或0027
,那就是chmod -R g + rX
)。这是因为umask
仅影响新创建文件的权限,而不是现有文件。
这个设置与直接创建一个git仓库(没有gitolite)时的用法相似:
core.sharedRepository
当
group
(或true
),该存储库可以在组中的多个用户之间共享(确保所有文件和对象都是可写组的)。
当all
(或world
或everyone
)时,存储库除了group-shareable
。umask
(或false
),git将使用由umask
报告的权限。
另见如何与一台机器上的多个用户共享一个Git仓库?以获得更多信息。
当您的平台与权限相冲突时,您也可以选择指示git忽略文件权限更改( git config core.fileMode false
)。 p>
更新:这个回答涵盖了gitolite 2.使用gitolite 3,设置从 $ REPO_UMASK
更改为 $ UMASK
。
I have set up Git and Gitolite, and at some point I recall having seen an "umask" setting, in one of the configuration files. Does this set the permissions for all files I sync using Git? That is exactly what I need. Where can I find it?
The umask settings in Gitolite are there for changing the umask for newly created repos (and not about the files managed in versions by those repos).
See gitolite.rc doc:
$REPO_UMASK
, octal, default 0077The default
UMASK
that gitolite uses makes all the repos and their contents haverwx------
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 bechmod -R g+rX
). This is becauseumask
only affects permissions on newly created files, not existing ones.
This settings is similar to the one use when you create directly a git repo (without gitolite):
core.sharedRepository
When
group
(ortrue
), the repository is made shareable between several users in a group (making sure all the files and objects are group-writable).
Whenall
(orworld
oreverybody
), the repository will be readable by all users, additionally to beinggroup-shareable
.
Whenumask
(orfalse
), git will use permissions reported byumask
.
See also "How do I share a Git repository with multiple users on a machine?" for more.
When you have conflicts between platforms relative to permissions, you also have the option to "instruct git to ignore file permissions changes" (git config core.fileMode false
).
Update: This answer covers gitolite 2. With gitolite 3 the setting changed from $REPO_UMASK
to just $UMASK
.
这篇关于在Git / Gitolite中设置umask的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!