I created a Git repository on a folder that had a different Linux owner than my user. It wasn't until much later that I set the group permissions to write so that my user could make changes and commits to Git. However, whenever I switch fr开发者_开发百科om a branch to master, all the group write permissions are lost.
I've tried switching to the master branch, and using the root user to make all files write-enabled for the group I'm in. But when I switch to a different branch, all the group write permissions are lost again.
I don't think that this is git specific, git will just use the current group and umask for checking out files so if you want your working tree to be a specific group an writable by that group you should either use newgrp
to log in to the required group or recursively set the group and setgid bit on the working tree and ensure that your umask excludes the group writable bit (e.g. 0002).
Git does not track permissions (except for the executable flag). So make sure that the umask
of your current user is set to not remove the group-writable flag from files. It is normally set to 022
, in your case it should be set to 002
. man umask
for more details.
精彩评论