Is there a way to prevent Git from changing permissions?

Is there a way to prevent Git from changing permissions?

Every time I do git pull or git reset, git resets changes to permissions and ownership I made. See for yourself: Is there a way to work around it? I want to make some files/directories accessible for writing by the web server.

When does git pull change the owner of a file?

1 Answer 1. When you use git pull (which is equivalent to git fetch; git merge), git will update files without changing owner (git does not store that information). But if there is new files to create, the current user will be set as the owner.

How to run git pull as the John user?

Run git pull as the john user instead of root (that will require write permissions to john for .git directory). Create a hook to make the deployment, which will either use john as user, either do the chown after update (so you will have to do git pull inside the post-receive hook of the bare repo).

What’s the difference between GIT fetch and git pull?

When you use git pull (which is equivalent to git fetch; git merge ), git will update files without changing owner (git does not store that information). But if there is new files to create, the current user will be set as the owner. There is different solution to solve this.

What happens to my CSS file after a Git checkout?

A direct result of this is that our CSS files become unreadable after a checkout, as Git changes the file ownership to the person who did the Git pull in the webroot. I want to keep ownership as user_a:group_a.

Which is the default group in Git clone?

This sounds like the user you’re running has the default group set to yuri. You can confirm this like so: The UID of your account is this: uid=1000 (saml) whereas the default group is git=1000 (saml) and any secondary groups are thereafter. NOTE: If you want the git clone to have specific ownership, then you have at least 2 options.

How do I set the setgid bit in Git?

Setting the setgid bit on existing subdirectories must be done manually, with a command such as the following: Git isn’t a deployment server. It writes files as whoever’s writing the files, that would be you.