Git change default umask when update file

前端 未结 4 454
梦谈多话
梦谈多话 2020-12-08 08:09

I have a problem with Git. I searched for a solution in Google and in StackOverflow but nothing helps.

The problem is that every time git updates some file in the wo

4条回答
  •  無奈伤痛
    2020-12-08 08:25

    It is kind of dangerous to allow file execution as a binary. Anyway I solved the problem with umask. My post-receive script looks like:

    !/bin/sh
    umask 002
    GIT_WORK_TREE=/var/www/site git checkout -f
    

    So, file permissions set to 664 and directory permissions set to 775, which suits me perfectly.

    P.S. Setting umask in a .profile file of git user has no effect, and I don't understand why, please comment out if you know why this happens.

提交回复
热议问题