Some time ago I worked in a project developed by several people. One of the people, consciously or not, changed the chmod some files. When the changes push into the repository, each time, another download the code from there cause in start, a many files was markes as "changed". I lost a lot of time to find reason.
Now when taking the repo i each time write in terminal
git config core.fileMode false
to ignore the change file permissions. I know that i can set that in global git config file, but i would make something more. I would like to have this option set as default in project repository and everyone who download this repo, will be set git config to ignore files permission.
Have any idea how reach that ?
答案 0 :(得分:1)
Git ignores all permission bits other than the executable bit
(In other words, file and directory entries of git's tree objects have a permission mask of either 755 or 644 -- nothing else).
core.fileMode
is only about the executable bit. You usually want those executable bits honored, except on some weird filesystems, in which case the user should turn core.fileMode
off by themselves.
From git help config:
core.fileMode Tells Git if the executable bit of files in the working tree is to be honored.
Some filesystems lose the executable bit when a file that is marked as executable is checked out, or checks out an non-executable file with executable bit on. git-clone(1) or git-init(1) probe the filesystem to see if it handles the executable bit correctly and this variable is automatically set as necessary. A repository, however, may be on a filesystem that handles the filemode correctly, and this variable is set to true when created, but later may be made accessible from another environment that loses the filemode (e.g. exporting ext4 via CIFS mount, visiting a Cygwin created repository with Git for Windows or Eclipse). In such a case it may be necessary to set this variable to false. See git-update-index(1). The default is true (when core.filemode is not specified in the config file).