I am the only person involved in this git project. Every time I edit files in my local Ubuntu repository, then click on Bitbucket and pull to my production repository, git changes the edited files to -rwxrwxr-x 775. Apache doesn't like it.
Local system: git version 1.8.1.2 on Ubuntu Linux
Production system: git version 1.7.12 on CentOS / Red Hat Linux
When I fix permissions at 755, then
git diff
or
git diff -p
He does not show anything.
There are 755 permissions in my local repository, and all files belong to haws. In my product repository, all other permissions remain at 755, and all files, including contact.php, belong to my username.
In the local and production repository, I changed core.filemode as follows, trying to stop this behavior,
core.filemode = false
I had such secrets in collaborative projects, so I really would like to understand what is happening.
- What can I do to see git reason for changing permissions of this file?
- How can I get git to stop changing it?
I also tried to find a solution here: Prevent git from changing permissions on click to no avail.
My final decision (thanks to VonC leadership):
Thanks to VonC's good explanations, I was brave enough to realize that every time I logged into my server, my umask returned to 0002. Thus, I created a custom script run (.bashrc or in my case .bash_profile) on my Linux host that installs
umask 0022
or using symbolic notation (for small added value)
umask u=a,gw,ow
or
umask u=a,go-w
(Allow all permissions for the user, deny write permissions for the group and others)
This solved my problem.
- I previously set git config core.sharedRepository to true, but this is not my problem, and I deleted the parameter after fixing the problem.