Git Windows Multiple User - Group Permissions Issue

1.3k views Asked by At

I have an problem with my client/server git configuration which is creating permissions issues when there are multiple users pushing changes. My users are getting the error:

remote: error: insufficient permission for adding an object to repository database ./objects

My Configuration The git repository is located on a NetApp network share. This network share is mounted on a Red Hat (RHEL) 6.4 Linux Server. To create the repository the user logs into the RHEL Server, navigates to where they want the repository (on the mounted share) then run the command:

git init --bare --shared=true repo.git

Each user is works locally on their own Windows 7/10 machine, they have git windows installed, and they have the previously mentioned network share mapped as a drive. To get the repository on their machine they open git-bash and navigate to where they want to clone the repo locally. They then run:

git clone Z:/git_repo_location/repo.git 

The Issue Users are able to push changes to the repository and everythings works fine until they attempt to push changes to a file which someone else had previously edited. This is when the error listed above rears its ugly head.

Reviewing the permissions from RHEL it appears that the folders in repo.git/objects are set to 755. I believe what is happening is when an objects folder is owned by User A, User B is unable to push changes to the affected files. As a note I have had all users update their umask in git-bash to 0002 (from the default 0022). Also all files/folders in the repo.git repository are owned by group "DTG" and all users working on this repo belong to this group.

Attempted Fixes I have tried creating/initializing repositories several other ways but each one has the same results:

Create repo2.git
  git init --bare repo2.git
  cd repo2.git
  git config core.sharedRepository group
  chgrp -R dtg .
  chmod -R g+w . 
  chmod g+s `find . -type d`

Create repo3.git
  git init --bare repo3.git
  cd repo3.git      
  chgrp -R dtg .
  chmod -R g+w . 
  chmod g+s `find . -type d`
  git init --bare --shared=all 

Create repo4.git
  git init --bare repo4.git
  cd repo4.git 
  git config core.sharedRepository true     
  chgrp -R dtg .
  chmod -R g+swX . 
  chmod g+s `find . -type d`
  git init --bare --shared=all 

I have also tried having the users clone the repository while setting the local sharedRepository config

git clone --config core.sharedRepository=true Z:/git_repo_location/repo.git

So far the only thing that fixes this issue is if I log into the RHEL machine and add the group permission to the objects folders:

chmod -R g+w repo.git/objects/

The problem is that this is only a temporary bandaid to fix the immediate issue. But as soon as someone pushes changes again I'm left with objects folders missing the group write permisison and the next user will be blocked again.

Any help figuring this out would be greatly appreciated!!! Also if any additional information is needed please let me know. Most of the attempted solutions above come from another similar question How to configure an existing git repo to be shared by a UNIX group

1

There are 1 answers

0
umläute On

this seems to be a problem of the middle-layer for file-sharing. assuming you are actually using SAMBA to provide a network share to be mounted from the w32 guests, the umask and similar settings will not help you very much (since permissions are actually handled by the samba server and the w32 client - the latter often trying to make very restrictive files)

you might have luck with something like:

[git]
        comment = GIT repositories
        path = /path/to/git/repos
        read only = No
        force group = dtg
        create mask = 0664
        directory mask = 0775
        force directory mode = 0770
        force create mode = 0660