一个目录中有多个Git存储库 [英] Multiple Git repositories in one directory
问题描述
我想将目录部署到具有不同权限的多个开发人员。所以这是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?
推荐答案
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屋!