推送到NFS共享上的Git存储库失败 [英] Pushing to a Git repository on an NFS share fails

查看:135
本文介绍了推送到NFS共享上的Git存储库失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们目前在本地磁盘上有我们的Git存储库。它们由组共享并通过SSH(使用git-shell)访问。



由于存在空间问题,我们现在想要将存储库移动到NAS上的NFS共享。我一直在试验这个,并且遇到了一个奇怪的问题。一个具有完全相同权限的全新(纯粹)存储库可以很好地克隆,但是推送更改(触摸foo& git add foo&&git commit&& git push origin master)失败,出现错误无法设置refs / heads / master和无法写入。

现在,如果我在本地磁盘上重复此方案,则refs / heads / master将变为由任何用户推送拥有。相反,在NFS共享上,如果我将其所有者更改为尝试推送的用户,则不会引发错误。但是,在这两种情况下,用户都是拥有整个存储库并具有组写入权限的组的成员。另外,如果我只是使用SSH作为该组成员的用户登录,那么我可以在NFS共享和本地磁盘上触及refs / heads / master(按照预期)。



因此,我在这里不知所措。我不知道为什么不同的文件所有者会导致推送失败,看到组权限允许用户覆盖refs / heads / master。此外,即使在该文件上有一个chmod 777,推送也会失败,除非我更改文件。



如果任何人都可以看到这个奇怪的东西,感激。提前致谢!

解决方案

NAS正在做许多奇怪的事情,在所有目录上设置粘性位。这解释了这种行为。额外的chmod解决了这个问题。


We currently have our Git repositories on the local disk. They are shared by groups and accessed over SSH (with git-shell).

Because of space issues, we now want to move the repositories to an NFS share on a NAS. I've been experimenting with this, and have run into a weird issue. A fresh (and bare) repository with exactly the same permissions can be cloned fine, but pushing changes (touch foo && git add foo && git commit && git push origin master) fails with the error "Couldn't set refs/heads/master" and "failed to write".

Now, if I repeat this scenario on the local disk, refs/heads/master becomes owned by whatever user pushed. Conversely, on the NFS share, if I change its owner to the user who is trying to push, no error is thrown. However, in both cases, the user is a member of a the group that owns the entire repository and has group write permission. Additionally, if I just log in using SSH as a user who is a member of this group, I can touch refs/heads/master (as is to be expected), both on the NFS share and the local disk.

Consequently, I am at a loss here. I have no idea why a different file owner would cause the push to fail, seeing as how the group permissions allow the user to overwrite refs/heads/master. Moreover, even with a chmod 777 on that file, the push fails unless I chown the file.

If anyone can shed some light on this weirdness, I'll be most grateful. Thanks in advance!

解决方案

Ah, darn. The NAS is doing weird things to permissions, setting the sticky bit on all directories. This explains the behavior. An additional chmod solved the problem.

这篇关于推送到NFS共享上的Git存储库失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆