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?
问题:
回答1:
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
.