git如何处理文件夹权限?

编程入门 行业动态 更新时间:2024-10-27 14:23:12
本文介绍了git如何处理文件夹权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我使用的是git版本1.5.6.3,似乎git并没有注意到文件夹的模式更改

I'm using git version 1.5.6.3, and it seems git doesn't notice a folder's mode changes

#create a test repository with a folder with 777 mode :~$ mkdir -p test/folder :~$ touch test/folder/dummy.txt :~$ cd test :~/test$ chmod 777 folder/ #init git repository :~/test$ git init Initialized empty Git repository in ~/test/.git/ :~/test$ git add . :~/test$ git commit -m 'commit a directory' Created initial commit 9b6b21a: commit a directory 0 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 folder/dummy.txt #change folder permission to 744 :~/test$ chmod 744 folder/ :~/test$ git status # On branch master nothing to commit (working directory clean)

什么 04000 代表?

:~/test$ git ls-tree HEAD folder 040000 tree 726c1d5f0155771348ea2daee6239791f1cd7731 folder

这是正常的行为吗?

如何跟踪文件夹模式更改?

How can I track folder mode changes?

推荐答案

code> git

The only 'permissions' bit that git tracks is the executable bit for files, the rest of the mode bits describe what type of file system object the object in each git tree is. git supports files and symlinks (blobs), directories (trees) and the submodules (commits).

git 旨在帮助跟踪不同机器上的源代码。权限位取决于机器之间的用户和组映射。在这些映射不存在的分布式环境中,跟踪权限位通常会阻碍事情而不是帮助任何事情。

git is designed to help track source code across different machines. Permission bits depend on user and group mappings between machines. In distributed environments where these mappings don't exist, tracking permission bits usually ends up hindering things rather than helping anything.

如果您需要跟踪更多的文件系统属性,那么 git 本机可以考虑和扩展工具,例如 etckeeper 。

If you need to track more file system attributes that what git tracks natively you could consider and extension tool such as etckeeper.

更多推荐

git如何处理文件夹权限?

本文发布于:2023-11-11 21:28:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1579605.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何处理   文件夹   权限   git

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!