we have a git server, what is actually used with one user of the remote. So every developer uses ssh://git@gitserver/gitdir/repoX.git
to access this remote. Now its necessary to give access to a guest developer to only one special repo (repo5).
My way was to add a linux-user (guestdev) on gitserver and to add an extra usergroup (repo5group). Both users (git and guestdev) are added to repo5group.
Then I chowned the repo5 recursivly to repo5group and set the group suid flag recursivly to all folders in repo5. The accessrights of all content of repo5 is set to rw for group.
Now guestdev has full access to the content of repo5 in the filesystem and if something is created in his/her session, it will get the same permissions.
When I try to locally clone the ssh://git@gitserver/gitdir/repo5.git
, everything works like expected, but when I clone with ssh://guestdev@gitserver/gitdir/repo5.git
I get the following error:
fatal: detected dubious ownership in repository at '/gitdir/repo5.git'
To add an exception for this directory, call:
git config --global --add safe.directory /home/git/git/Leitstand/TestGit.git
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Ofcourse I could do the git config as suggested. But I want to understand, whats the problem. Maybe this is also the complete wrong way to give a second user access to one special repo and you have a easier and more elegant way to do it.
We use plane git from bash.
Thank you.