一个目录中有多个Git存储库 [英] Multiple Git repositories in one directory

查看:132
本文介绍了一个目录中有多个Git存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将目录部署到具有不同权限的多个开发人员。所以这是Git无法做到的一件事。如何在一个目录中创建两个存储库,并通过排除其他存储库管理的文件并使用 .gitignore 文件为其分配不同的文件列表。

I would like to deploy a directory to multiple developers having different permissions. So this is one thing Git cannot do. What about creating two repositories in one directory and assigning them different file lists by excluding files managed by the other repository with the .gitignore file.

例如: /www/project/.git 用于除 / www / project / css之外的所有文件
/ www / project / css / .git
- >这个目录中只有文件

Example: /www/project/.git for all files except in /www/project/css /www/project/css/.git -> only files in this directory

有没有人试过这个解决方案?或者有没有更好的方法来处理这个问题?

Has anyone tried this solution? Or are there any better ways to handle this issue?

推荐答案

gitslave Gitslave创建了一组相关的存储库 - 一个超级项目存储库和一些从属存储库 - 所有这些同时开发所有git操作应正常运行;所以当你分支时,项目中的每个存储库都会依次分支。同样,当你提交,推,拉,合并,标签,签出,状态,日志等;每个git命令将依次在超级项目和所有从属仓库上运行。 CVS和(在较小程度上)Subversion用户可能非常熟悉这种活动。 Gitslave的设计是为了简化正常的git操作。

A less annoying approach than git-submodules (which are a pain to use) is gitslave Gitslave creates a group of related repositories—a superproject repository and a number of slave repositories—all of which are concurrently developed on and on which all git operations should normally operate; so when you branch, each repository in the project is branched in turn. Similarly when you commit, push, pull, merge, tag, checkout, status, log, etc; each git command will run on the superproject and all slave repositories in turn. This sort of activity may be very familiar to CVS and (to a lesser extent) Subversion users. Gitslave's design is for simplicity for normal git operations.

我还会指出 etckeeper ,它会跟踪权限。它有它自己的特性,它可能会或可能不会使它适用于你。

I'll also point you to etckeeper which does track permissions. It has its own peculiarities which may or may not make it usable for you.

最后,我会注意到你可以有一个custome post-checkout脚本来设置适当的对相应文件/目录的权限。

Finally, I'll note you can have a custome post-checkout script which sets the appropriate permissions on the appropriate files/directories.

这篇关于一个目录中有多个Git存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆