Git - multiple users using the same working dir: permissions issues in .git meta-files

前端 未结 2 1733
轮回少年
轮回少年 2021-01-30 23:59

The Issue: when multiple users have access to the same working directory, permissions issues can occur in the meta-data if any git operations are p

2条回答
  •  闹比i
    闹比i (楼主)
    2021-01-31 00:57

    I just faced this issue and took me hours to find the solution when it was so simple. I tried almost everything I see on the other link provided by CodeGnome.

    I'm using Centos 6.x and the solution was to change the umask on users... this require we do it with each account... We are only 2 working on the same directory. Not that much of a pain.

    The solution that worked for me is this one, without having to change the server's configuration: http://www.avajava.com/tutorials/lessons/how-do-i-set-the-default-file-and-directory-permissions.html

    If the .bashrc filoe do not exists in /home/user directory, like this was in my case, you only need to copy from the skeleton the file in /ect/skel and then you copy it your home (users) directory after adding at the end of the file:

    umask 002
    

    This gives the user a chmod 775 on the new folders created by others in the group. Of course, once this project will be completed, not anymore in a testing environment, we will set it back to chmod 755 (umask 022) by default. This not only give Git the permission to overwrite but also to write files uploaded on sFTP without having the permission denied issue. .

提交回复
热议问题