Git,如何将裸仓库更改为共享仓库?
这就是我设置项目的方式:
git init --bare
后来我了解到,如果你想与多个用户一起开发一个项目,我应该这样做:
git init --bare --shared
现在我尝试像那样工作,幸运的是我们还处于开始阶段,所以我可以再次设置git。我仍然想知道当你正在进行一个项目时你不能这样做。 有没有一种方法可以将裸存储库更改为共享存储库?
So this is how I set up my project:
git init --bare
Later I learned that if you want to work on a project with multiple users this is how I should have done it:
git init --bare --shared
Now I tried to work like that and luckily we are in the beginning so I could set up git again. I still wonder though when you're in the middle of a project you can't do that.
Is there a way that i can change a bare repo to a shared one?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
由于
--shared
选项只是将存储库中所有内容的权限设置为组可写,您可以稍后手动执行此操作:另外,
在
[core]
部分下 添加.git/config
。共享存储库还默认定义了以下接收选项(您可能希望也可能不希望):注意:为了决定是否需要 DenyNonFastforwards:此选项意味着共享存储库中永远不会发生合并,这反过来又意味着共享存储库上永远不会发生合并冲突。相反,推送会被拒绝,迫使用户在本地存储库中进行合并,这样更容易修复,并且不会干扰其他人对共享存储库的使用。
Since the
--shared
option just sets the permissions on everything in the repository to group-writable you could do this manually later:Plus, add
under the
[core]
section in.git/config
. Shared repos also have the following receive option defined by default (which you may or may not want):Note: In order to decide whether you want denyNonFastforwards: This option means a merge never happens in the shared repository, which, in turn, means there is never a merge conflict on the shared repository. Instead the push is rejected forcing the user to do the merge in their local repository where it's much easier to fix and where it doesn't interfere with other people's use of the shared repo.
除了 chmod -R g+w 之外,您还需要编辑
(.git/)config
并设置core.sharedRepository = ...
。对于...,有一些值,如 git-init(1) 中所述。Besides chmod -R g+w, you also need to edit
(.git/)config
and setcore.sharedRepository = ...
. For ..., there are a handful of values, described in git-init(1).如果您尝试共享现有存储库,可能会有许多不同的用户提交。
1.如果您有超级用户权限,您可以使用第二步自行更改所有权限,否则您将需要询问所有使用其用户创建对象的用户,使用以下命令来了解谁它们是:
2.现在,您和所有文件的所有者用户必须更改这些文件的权限,执行:
3.之后,您将需要添加一个新属性,该属性相当于为新存储库完成的 --shared=group ,根据对于文档,这使得存储库组可写,执行:
Probably if you try to share an existent repository, you may have lots of different users commits.
1.If you have super user permission, you can go forward and change all permissions by yourself using the step two, in any-other case you will need to ask all users with objects created with their users, use the following command to know who they are:
2.Now you and all file's owner users will have to change those files permission, doing:
3.After that you will need to add a new property that is equivalent to --shared=group done for the new repository, according to the documentation, this make the repository group-writable, do it executing:
如果您尝试从其所在的主机共享存储库,则必须执行其他配置步骤(ssh 内容)。
http://shapeshed.com/setting_up_git_for_multiple_developers/
http://www.jedi.be/blog/2009/05/06/8-ways-to-share-your-git-repository/
If you're trying to share the repository off of the the host it is on, there are additional configuration steps you have to make (ssh stuff).
http://shapeshed.com/setting_up_git_for_multiple_developers/
http://www.jedi.be/blog/2009/05/06/8-ways-to-share-your-git-repository/