保护git仓库中的文件 [英] Protecting files in git repository
问题描述
我有一个中央存储库,其中包含一些我希望保护的文件子集,以免被其他用户更改(推送)。如果我将这些文件添加到 .gitignore
,它们将不会被克隆。
是否可以赋予该能力克隆所有文件,但在克隆之后,在客户端添加一些到 .gitignore
?
在我看来,如果你需要这个级别的访问限制,问题在于别处。
然而,如果你真的想要实现这个,请考虑 Gitolite 。它允许您定义相当详细的访问规则,并可能满足您的需求。
Gitolite文档: http://gitolite.com/gitolite/master-toc.html
您可以定义'虚拟参考来控制文件级别的访问。更多内容: http://gitolite.com/gitolite/vref.html
I have a central repository with a subset of files that I want to protect from being changed (by pushing) from other users. If I add these files to .gitignore
, they would not be cloned.
Is it possible to give the ability to clone all files, but after cloning add some of them to .gitignore
on the client side?
It sounds to me like the problem lies elsewhere if you need this level of access restriction.
Nonetheless, if you indeed do want to implement this, consider Gitolite. It allows you to define rather detailed access rules and should probably suffice for your needs.
Gitolite documentation: http://gitolite.com/gitolite/master-toc.html
You can define 'virtual refs' to control access on file level. More on that: http://gitolite.com/gitolite/vref.html
这篇关于保护git仓库中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!