Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git keeps removing group write permissions

I have a git repository that I am sharing with several developers. We do regular git pulls and pushes with it. Unfortunately, every time I do a git pull the changed files lose the group write permission. How do I stop git from doing this?

I am running this on Ubuntu 12.04 LTS.

The config on the shared repo looks like this:

[core]
        repositoryformatversion = 0
        filemode = true
        bare = true
        sharedRepository = group

I also ran the following commands on it in an attempt to fix it

find repo.git -type d -exec chmod g+rws {} +
sudo chmod -R g+rw repo.git/objects

No matter what I end up with folders with 755 and files with 644 when I want 775 and 664 respectively.

like image 789
Bernard Igiri Avatar asked Feb 15 '13 18:02

Bernard Igiri


People also ask

Does git remember file permissions?

Git Tracks ONLY the Executable Bit of the Permissions for the User Who Owns the File.

Does git change file permissions?

Yes, by default, git is configured to track the changes in file permission mode, too. Just to experiment with the idea, I created a dummy repo and "touched" an empty file. The initial default permission was 775.


1 Answers

You should use the core.sharedRepository=group or core.sharedRepository=0664 setting.

See e.g. http://criticallog.thornet.net/2010/01/07/sharing-your-git-repository/

like image 119
w00t Avatar answered Oct 26 '22 03:10

w00t