gpt4 book ai didi

git - 在 Git/Gitolite 中设置 umask

转载 作者:IT王子 更新时间:2023-10-29 01:30:35 25 4
gpt4 key购买 nike

我已经设置了 Git 和 Gitolite,我记得在某个时候在其中一个配置文件中看到了“umask”设置。这是否为我使用 Git 同步的所有文件设置了权限?这正是我所需要的。我在哪里可以找到它?

最佳答案

umask settings in Gitolite是否可以为新创建的存储库更改 umask(而不是关于那些存储库在版本中管理的文件)。
参见 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.

此设置类似于直接创建 git 存储库(没有 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.

另请参阅“How do I share a Git repository with multiple users on a machine?”了解更多信息。

当平台之间存在权限冲突时,您还可以选择“instruct git to ignore file permissions changes”(git config core.fileMode false)。

更新:这个答案涵盖了 gitolite 2。对于 gitolite 3,设置从 $REPO_UMASK 更改为 $UMASK

关于git - 在 Git/Gitolite 中设置 umask,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7086325/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com