gpt4 book ai didi

git - Git对象权限-SSH

转载 作者:行者123 更新时间:2023-12-02 14:10:01 27 4
gpt4 key购买 nike

我在服务器上创建了一个裸仓库。我正在与另一位开发人员合作,并希望共享对此存储库的访问权限。我已经设置了chgrp -R staff repo.gitchmod -R 660 repo.git。我已将两个用户帐户都添加到人员组。我注意到在推送到此仓库后,repo.git/objects文件夹中的文件的所有权为shawn:shawnshawn:staff。现在,当我的其他开发人员进行推送时,他会遇到权限被拒绝的错误。如果我运行chgrp,则可以解决问题,但是,我确定这不是它的工作原理。处理此场景的正确方法是什么?

最佳答案

您是如何创建裸仓库的?
如“Git - Howto setup Shared Repository with SSH access ”中所述,您应该在 shared=group 中声明“git init --bare”。

--shared[=(false|true|umask|group|all|world|everybody|0xxx)]

Specify that the Git repository is to be shared amongst several users.
This allows users belonging to the same group to push into that repository.
When specified, the config variable "core.sharedRepository" is set so that files and directories under $GIT_DIR are created with the requested permissions.
When not specified, Git will use permissions reported by umas.

关于git - Git对象权限-SSH,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16453319/

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