管理没有root权限的git仓库 [英] Administrating a git repo without root permissions
问题描述
我想在我的主目录中创建一个纯粹的git-repo,让我的同事在同一个文件系统上工作,允许他们将 git push
放入它。但是,我不希望他们能够使用 git
以外的任何其他方式意外修改回购,所以我不能只是 chmod g + w
it。
这可能不需要root吗?我能想到的唯一办法是将SUID位设置为 git
,这样git可以像我一样访问回购,但我不知道这是否真的是一个好主意...
您可以使用 gitolite ,它为你处理很多麻烦。
如果你想使用普通的git,你可以这样做:
要做到这一点,所有的同事和你需要在同一个团队(例如开发人员)。您可以一次性修复所有内容:
newgrp开发者
git init --bare --shared = group repo
但是当然你会得到一个空的存储库。您可以将当前的工作推到那里并继续。
如果您不使用git init路径,则需要自己设置适当的权限以及设置 core.sharedrepository = 1
配置变量。
I want to make a bare git-repo in my home directory accessible to my co-workers working on the same file system, allowing them to git push
into it. However, I don't want them to be able to accidentally modify the repo with anything but git
, so I can't just chmod g+w
it.
Is this possible without being root? The only thing I could think of was setting the SUID bit to git
so git could access the repo as me, but I don't know if that is really such a good idea...
You can use something like gitolite which deals with a lot of the hassle for you.
If you want to use plain git, you can do this:
To do this all of your co-workers and you need to be in the same group (e.g. developers). You can fix everything at once with:
newgrp developers
git init --bare --shared=group repo
but ofcourse you will get an empty repository. You can push your current work in there and continue from there.
If you do not use the git init path you will need to set the apprioprate permissions yourself as well as set the core.sharedrepository=1
config variable.
这篇关于管理没有root权限的git仓库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!