What makes git post-receive umask different from umask user?

After some searching and help here from other people , I found out that I have a problem with a parameter umaskin git. I want to make sure that any git reposition that is checked on my server is umaskset to 0002 by default. I don’t want to configure it in every column after receiving ... I want this to be the default umask. How do I achieve this?

My repositories are loaded by logging in to ssh with a user giton the server. When I check the parameter umask, it is already set to the correct setting:

root@server:~# su git 
git@server:~$ umask
0002

However, if I put umask > /tmp/debug.login my post-reception, then this file shows umask0077! What makes it different?

The root server also has the same umask, and I just can't figure out why it umaskdiffers when checking the repository. If I go to the user gitand create a file, then everything will work fine:

git@server:~$ touch newfile
git@server:~$ ls -la
total 8
-rw-rw-r-- 1 git git    0 Aug  6 02:17 newfile
-rw------- 1 git git    0 Aug  6 02:16 post

newfile- This is the file you just created. A file postis a file that I checked through git, obviously with different permissions. I also added a umaskgit user to the .bashrc, but to no avail:

git@server:~$ cat ~/.bashrc 
export LANGUAGE="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
export LANG="en_US.UTF-8"
export LC_TYPE="en_US.UTF-8"
umask 0002

For what it's worth, I use gitolit to manage my repositories.

And this is an example post-receive hook script I am using:

#!/bin/sh
export GIT_WORK_TREE=/home/user/www/
git checkout -f
+3
source share
2 answers

, , . ? , umask . , gitolite, , , . , , , :

~/.gitolite.rc:

:

$REPO_UMASK = 0077;

, :

$REPO_UMASK = 0002;

- !

+2

, , .

script #!/bin/sh, man sh rcfiles, .profile, /etc/profile, .bashrc . , . , .

, /bin/sh namei /bin/sh --help.

, , , script, :

{ echo this is file x; umask; } >> /tmp/debug.log

/tmp/debug.log.

+1

Source: https://habr.com/ru/post/1650306/


All Articles