GIT 如何在其权限下跟踪空文件夹
我需要跟踪一个包含空文件夹的文件夹(我将其命名为“root”)。 因此,我为每个空文件夹创建了一个空的 .gitignore,我添加了它们,但现在我想跟踪其权限(chmod 777 root -R
)。 但 git status
没有任何变化
I need to track a folder (I'll name it "root") that contains empty folders.
So I created an empty .gitignore for each empty folder, I added them but now I'd like to track its permissions (chmod 777 root -R
).
But nothing doesn't change on git status
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Git 不跟踪权限。它仅跟踪可执行性。就此事而言,也没有其他常见的版本控制工具可以跟踪权限。因此,您需要在这些工具之上构建一些东西来跟踪权限。例如 etckeeper。
这是通过在存储库中添加挂钩来实现的:
您甚至可以自己制作一些简单的单一用途的东西;它相当简单(这就是 Holygeek 下面讨论的内容)。
请注意,挂钩在工作树中运行。其他仅存储数据的存储库不需要任何东西,您甚至可以在不使用该工具的情况下在其他地方查看数据。但这些文件将不具有定义的权限。
Git does not track permissions. It only tracks executability. For the matter, no other common version control tool tracks permissions either. So you need something built on top of those tools to track permissions. E.g. etckeeper.
This works by adding hooks in the repository that:
You could even put up something simple single-purpose yourself; it's rather simple (that's what holygeek talks about below).
Note, that the hooks run in the work tree. Other repositories that just store the data don't need anything and you can even check out the data elsewhere without the tool. The files will not have the defined permissions there though.