开发者

Pushing to a Git repository on an NFS share fails

开发者 https://www.devze.com 2023-02-03 18:39 出处:网络
We currently have our Git repositories on the local disk. They are shared by groups and accessed over SSH (with git-shell).

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消