I recently had to setup a git repo on nfs path. So, there are the steps i used to setup it up (and Gotcha)
To do that, bare repo must be used. basically, bare repo is shared repo. You can’t work directly on it because it doesn’t have the source code. It contains whatever .git has.
Create bare repo
git init --bare myrepo.git
Then set your remote to the bare repo.
git remote add origin /path/to/repos/myrepo.git
to clone the repo
git clone /path/to/repos/myrepo.git
Gotcha Link to heading
It’s very easy, Right? Not. when you share that repo, people will start seeing permissions errors.
I found two solutions
Solution 1 Link to heading
Adding --shared
while creating the repo
git init --bare --shared myrepo.git
Solution 2 Link to heading
manually fixing permission on directories. i found that at link
chown -Rf root:git /path/to/bare/git/repo
cd /path/to/bare/git/repo
git config core.sharedRepository group
find /path/to/bare/git/repo -type f | xargs chmod 664
find /path/to/bare/git/repo -type d | xargs chmod 775
find /path/to/bare/git/repo -type d | xargs chmod g+s