7
1
I create a read-only file (file permission 444
). When I use git add
and git commit
, I got a message as below:
[master (root-commit) 5b1336e] initial commit
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 a.txt
The file permission is changed to 644
.
After I clone that repository, that file's permission is changed to 664
.
How could I let git to keep original permission?
OS: Ubuntu 14.04 Git: 1.9.1
1I think it make sense in the scenario like the file is used as a global config file for a tool. In a project that use that tool, people have stupid script to modify it which will break other projects. And also you still can edit read only file manually and commit the it. So for git, it can track
x
why not do the same thing forr
andw
? – Enze Chi – 2015-08-26T06:54:48.0771Git is not a deployment tool; you'll be much better off creating a package or installation script which gives files the correct rights on installation. This way you can also handle other file attributes such as for SELinux, and the deployed system won't contain a bunch of files which belong only on the developer desktop (
.git
directory, test files, etc.). – l0b0 – 2015-08-26T06:59:08.180