Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>As mentioned in "<a href="https://stackoverflow.com/a/5443141/6309">Wrong file permission when using git pull in a hook</a>"</p> <blockquote> <p>Git does not store permissions, <strong>apart from the executable bit</strong>.<br> So, on checkout, files are created with the default permissions, which depend on your <strong><a href="http://en.wikipedia.org/wiki/Umask" rel="nofollow noreferrer">umask</a></strong>.</p> </blockquote> <p>In your case: <code>umask 0022</code> should be set when you are pulling.<br> (that is what I was mentioning in the answer you saw "<a href="https://stackoverflow.com/a/12735291/6309">Prevent Git from changing permissions on pull</a>")</p> <p>This assume that you have, in the target repo, a configuration like:</p> <pre><code>git config core.sharedRepository true </code></pre> <p>The other solution is mentioned in "<a href="https://serverfault.com/a/113688/783">How do I share a Git repository with multiple users on a machine?</a>", where you would make sure to pull in a repo initialized like so:</p> <pre><code>git init --shared=0022 </code></pre> <hr> <p>The OP <a href="https://stackoverflow.com/users/563114/tom-haws">Tom Haws</a> adds in the comments:</p> <blockquote> <p>Do you know why git at my client's production server is able to pull without having file permission changes even when there is no <code>sharedRepository</code> entry in that repository's config?</p> </blockquote> <p>Maybe because umask was set by default to <code>0022</code> already, meaning that, by default, the git shell inherits the <code>umask</code> of the system.<br> Changing the <code>umask</code> requires a <code>core.sharedRepository</code> set to <code>true</code> to take it into account instead of taking the <code>umask</code> of the parent process.<br> That, or because the repo was created with <code>--shared=0022</code>.</p> <p>To see how an <code>umask</code> can be set (system wide or user-wide), see "<a href="https://stackoverflow.com/a/10221511/6309">How to set system wide <code>umask</code>?</a>"</p> <p>To check an <code>umask</code> just before a git command (which would inherit its value), simply type:</p> <pre><code>umask </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload