I have been came across this problem over and over again. I have a git repository set up on my remote server and all the files are set to 644 and folders are set to 755. However, every time after i pulling from git repository(i'm using bitbucket), i noticed the permission of the file which i modified was changed into 664 which results a Internal server Error. For example, I changed the index.php, and it occurs 500 when i tried to get access to it
i have to use
find . -type d -print0 | xargs -0 chmod 0755
and find . -type f -print0 | xargs -0 chmod 0644
to manually changed my files permission back to normal
By default, git will update execute file permissions if you change them. It will not change or track any other permissions. If you don't see any changes when modifying execute permission, you probably have a configuration in git which ignore file mode.
Git Tracks ONLY the Executable Bit of the Permissions for the User Who Owns the File.
From any folder in your local machine, type git ls-remote /url/remote/repo . But for any more advance permission check, you would need to go to the remote server hosting that repo. Or at list query that server, listing the members for a given project. See GitLab API "List all members of a group or project".
As described in "Git set create mode to 100664 when pushing new folder/files to shared repo":
git doesn't store file permissions at the level you want. Having 644 or 664 files depends purely on
umask
."
(022
in your case, as commented by Jan Hudec
Git only stores two permissions (755=rwxr.xr.x
, 644=rw.r..r..
).
git simply doesn't track permissions.
In fact, it refuses to. Turns out there are enough mutually-exclusive definitions of how to do it right, all of which can be whipped up with simple scripting, that the simple scripting is the right way to implement it.
Plus, those rules are best left per-repo, because there's repo purpose and host OS to consider.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With