'When I clone/pull git project files get -rw-r--r-- permission. How to avoid read-only access r-- to everyone on the machine in git projects?

I have reviewed cloned git projects and found that files have -rw-r--r-- permissions. It means any user on the system can read project files. Of course, it depends on folder permissions, but on some systems nobody and all other users can read projects.

Any suggestions if there is a fix for this issue? Why it happens?

For example this works:

sudo -u nobody cat /projects/project1/file1


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source