Pushing to a Git repository on an NFS share fails

怎甘沉沦 提交于 2019-12-01 08:06:01

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/4675587/pushing-to-a-git-repository-on-an-nfs-share-fails

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!