如何在git存储库上正确使用组文件权限? [英] How to use group file permissions correctly on a git repository?

查看:103
本文介绍了如何在git存储库上正确使用组文件权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们通过文件路径访问共享的git存储库,出于各种原因,我现在要用--shared = group创建。

We're accessing a shared git repository via file paths, for various reasons I'll omit for now, created with --shared=group.

我们有各种unix团体,但都共享一个共同的群体。如果我在git存储库上运行chgrp -R,每个人都可以从中读取它,但是如果有人写信给它,通常会创建不使用公共组的新文件。

We have various unix groups but all share a common group. If I run a chgrp -R on the git repository everyone can read from it, but if someone writes to it more often than not new files are created which do not use the common group.

这个问题似乎是因为我们的主要组不是共享的,如果我们运行newgrp,似乎都运行良好。

This problem appears to be because our primary group is not the shared one and if we run a newgrp all seems to work well.

有这个问题虽然; newgrp很慢,它产生了一个新的shell,这让我认为在.bash_profile中调用它是一个坏主意,甚至没有考虑我们是否想要所有我们的新文件使用普通组。尽管如此,在做任何git工作之前依靠内存来运行它似乎也是一种灾难。尽管如此,还是需要一些内存。

There are issues with this approach though; newgrp is slow and it spawns a new shell, which makes me think calling it in a .bash_profile would be a bad idea, without even considering whether or not we'd want all our new files to use the common group. Relying on memory to run it before doing any git work seems like a recipe for disaster too though.

所以...有什么建议?

So... any suggestions?

推荐答案

您需要设置 setgid bit


chgrp -R GROUP /path/to/repo
find /path/to/repo -type d -print0 | xargs -0 chmod g+s 

这篇关于如何在git存储库上正确使用组文件权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆