我有一个光秃的中央回购有这个选项打开:
git config core.sharedRepository true
出于某种原因,CentOS机器上的其他用户从中央仓库中拉出/推入时,总是遇到许可错误,当他们推到某个已经被推送的分支时。
我查看了目标目录,并意识到谁先推送他们的用户名设置为所有者和组。
我已经设置好了,所有的用户都属于“开发者”组,然后chgrp -R裸露的回购是属于“开发者”的集体所有权,但是这还没有解决问题。
还有其他build议吗?
更多信息:
这是我推时发生的事情:
[dave@localhost wd]$ git push Counting objects: 5, done. Compressing objects: 100% (2/2), done. error: insufficient permission for adding an object to repository database ./objects fatal: failed to write object error: pack-objects died of signal 13 error: failed to push some refs to '/gitrepos/repo.git'
正如你所看到的,裸露的中央仓库中的objects文件夹内的权限具有属于另一个用户的不同的权限,jane(为了可读性,这个列表被缩短了):
[dave@localhost objects]$ ls -la total 248 drwxrwxr-x 62 root developers 4096 Dec 13 15:37 . drwxrwxr-x 9 root developers 4096 Dec 13 15:34 .. drwxrwxr-x 2 root developers 4096 Dec 12 16:05 01 drwxrwxr-x 2 root developers 4096 Dec 12 16:05 2f drwxrwsr-x 2 jane jane 4096 Dec 13 15:37 30 drwxrwxr-x 2 root developers 4096 Dec 12 16:19 33 drwxrwxr-x 2 root developers 4096 Dec 12 16:05 39 drwxrwxr-x 2 root developers 4096 Dec 12 16:19 6c drwxrwxr-x 2 root developers 4096 Dec 12 16:05 89 drwxrwsr-x 2 jane jane 4096 Dec 13 15:37 8b drwxrwxr-x 2 root developers 4096 Dec 13 05:41 8e drwxrwxr-x 2 root developers 4096 Dec 12 16:19 90 drwxrwxr-x 2 root developers 4096 Dec 12 14:32 info drwxrwxr-x 2 root developers 4096 Dec 12 14:32 pack
您需要确保用户使用002作为他们的umask,以便创build的新文件是g + w,或者您需要使用扩展acl为在此存储库中创build的新文件设置默认权限。 umask是你在环境中设置的东西,也许在.bashrc或者/ etc / profile或者一些这样的启动文件中,但是它影响在任何地方创build的文件。 你不能将umask本地化到一个特定的目录。 如果在特定目录中需要此行为,则可能必须使用扩展文件系统ACL,这需要使用acl选项重新装入文件系统,并使用setfacl来更改默认的acls。 无论哪种情况,你都应该让“developers”和chmod g +拥有的所有目录组,这将使新的目录/文件inheritance这个组的所有权
在git init ,选项--shared=group对于类似的情况是有用的(它会执行g + sx的东西)