Git 无法处理 nfs 共享

Git not working on nfs share

首先,设置。我正在 运行 在 Windows Server 2012 上安装 haneWin nfs 服务器,在启动时将其安装在 ubuntu 服务器中,并带有此 fstab 条目 ~ip~:/sharenfs /srv/share nfs rw 0 0
windows 服务器上的 umask 设置为 000,这确实导致 ubuntu 上的每个用户都具有对整个共享的读写访问权限。

现在的问题是:我想使用 nfs 共享来存储我们所有的 git 存储库,以便 windows 服务器可以将它们连同其所有数据一起备份。在较早的设置中,ubuntu 主机提供了一个工作完美的 nfs 共享,但出于存储原因,windows 服务器应该托管该共享。

git repos 应该由 redmine 自动创建,它在 nfs 更改之前运行良好,但现在它只是默默地失败了。日志没有提供任何有用的信息。

但是这里确实提供了一些信息,如果我在 nfs 共享上创建一个新目录,运行 git init,会出现以下内容:

error: could not lock config file /srv/share/git/metatest/test1/.git/config: File exists
... (this line shows a total of 6 times)
error: could not lock config file /srv/share/git/metatest/test1/.git/config: File exists
Reinitialized existing shared Git repository in /srv/share/git/metatest/test1/.git/

目录完全是空的!事实上 运行ning rm -rf .git; git init 具有相同的输出。

一个ls -lAhR显示这个

./.git:
total 22K
drwxrwxrwx 2 git git 4.0K Jun  5 17:07 branches/
-rw-rw-rw- 1 git git   53 Jun  5 17:07 config
-rw-rw-rw- 1 git git   21 Jun  5 17:07 config.lock
-rw-rw-rw- 1 git git   73 Jun  5 17:07 description
-rw-rw-rw- 1 git git   23 Jun  5 17:07 HEAD
drwxrwxrwx 2 git git 4.0K Jun  5 17:07 hooks/
drwxrwxrwx 2 git git 4.0K Jun  5 17:07 info/
drwxrwxrwx 4 git git 4.0K Jun  5 17:07 objects/
drwxrwxrwx 4 git git 4.0K Jun  5 17:07 refs/

./.git/branches:
total 0

./.git/hooks:
total 17K
-rwxrwxrwx 1 git git  452 Jun  5 17:07 applypatch-msg.sample*
-rwxrwxrwx 1 git git  896 Jun  5 17:07 commit-msg.sample*
-rwxrwxrwx 1 git git  189 Jun  5 17:07 post-update.sample*
-rwxrwxrwx 1 git git  398 Jun  5 17:07 pre-applypatch.sample*
-rwxrwxrwx 1 git git 1.7K Jun  5 17:07 pre-commit.sample*
-rwxrwxrwx 1 git git 1.3K Jun  5 17:07 prepare-commit-msg.sample*
-rwxrwxrwx 1 git git 1.4K Jun  5 17:07 pre-push.sample*
-rwxrwxrwx 1 git git 4.8K Jun  5 17:07 pre-rebase.sample*
-rwxrwxrwx 1 git git 3.6K Jun  5 17:07 update.sample*

./.git/info:
total 512
-rw-rw-rw- 1 git git 240 Jun  5 17:07 exclude

./.git/objects:
total 8.0K
drwxrwxrwx 2 git git 4.0K Jun  5 17:07 info/
drwxrwxrwx 2 git git 4.0K Jun  5 17:07 pack/

./.git/objects/info:
total 0

./.git/objects/pack:
total 0

./.git/refs:
total 8.0K
drwxrwxrwx 2 git git 4.0K Jun  5 17:07 heads/
drwxrwxrwx 2 git git 4.0K Jun  5 17:07 tags/

./.git/refs/heads:
total 0

./.git/refs/tags:
total 0

有趣的是,当 redmine 尝试创建存储库时,甚至没有创建目录。同样,它默默地失败了,没有有用的输出。

当我尝试 运行 git add 或从远程电脑推送 redmine 工作时创建的现有存储库的任何更改时,我得到

fatal: error when closing sha1 file: Permission denied

这一切对我来说完全没有意义。有什么想法吗?

关于问题的原因,问题可能并不完全正确。事实证明,通过将 gitolite 安装移植到 SMB 挂载,然后将其移动到 NFS 挂载后,gitolite 安装被破坏了问题仍然存在。
我不能确定这是否真的发生了,但现在它正在 NFS 共享上工作,这是我最可能的解释。

另一种解释是 hanewin nfs 是问题所在,因为现在 运行 Windows Server 2012 NFS 服务器正在运行。