Setting umask in Git / Gitolite

这一生的挚爱 提交于 2020-01-20 02:19:28

问题


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 0077

The default UMASK that gitolite uses makes all the repos and their contents have rwx------ 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 be chmod -R g+rX). This is because umask 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 (or true), the repository is made shareable between several users in a group (making sure all the files and objects are group-writable).
When all (or world or everybody), the repository will be readable by all users, additionally to being group-shareable.
When umask (or false), git will use permissions reported by umask.

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.



来源:https://stackoverflow.com/questions/7086325/setting-umask-in-git-gitolite

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!