【发布时间】:2011-11-08 06:34:24
【问题描述】:
Git 允许在组之间创建共享存储库:
git --bare init --shared=group
但是 - 我如何将现有的存储库更改为共享?我不想重新 git-init 它。
【问题讨论】:
Git 允许在组之间创建共享存储库:
git --bare init --shared=group
但是 - 我如何将现有的存储库更改为共享?我不想重新 git-init 它。
【问题讨论】:
--共享[=(false|true|umask|group|all|world|everybody|0xxx)]
指定 git 存储库将在多个用户之间共享。 这允许属于同一组的用户推送到该存储库。 指定时,设置配置变量“core.sharedRepository”,以便
$GIT_DIR下的文件和目录是使用请求的 权限。未指定时,git 将使用 umask(2) 报告的权限。
因此,为了更改权限,chmod 一切随心所欲,set the core.sharedRepository in git config 相应地:
git config core.sharedRepository true
【讨论】:
rm file && git checkout file) 创建一个新文件,并确保它具有适当的权限(组可以读取)。
要共享一个私有的裸 repo 组:
sharedRepository = group 添加到core 部分chgrp -R target-group .find . -type d | xargs chmod g+wsfind refs -type f | xargs chmod g+w【讨论】:
sharedRepository = mygroup 返回remote: fatal: bad numeric config value 'mygroup' for 'core.sharedrepository': invalid unit 并且这些chmods 都没有修复权限。
sharedRepository = group,not sharedRepository = mygroup,也就是说,这不是你正在使用的组,但总是group。在示例中,您使用的组是 target group。如果您以足够的权限运行这些命令,它们肯定可以在任何类 Unix 操作系统上运行。
--shared 似乎也将其添加到我的配置中:[receive] denyNonFastforwards = true。我假设在将现有存储库转换为共享存储库时手动添加它是个好主意。