通过桑巴Git不能获取/添加/提交了 [英] Git over samba cannot fetch/add/commit anymore
问题描述
我曾多次使用过git trough samba,没有任何问题。
然而,在最后的日子里,似乎不可能git all / fetch / commit
错误是:
错误:没有足够权限将对象添加到存储库数据库.git / objects
使用strace我可以看到这个错误是由于打开时调用:
[pid 31303] open(.git / objects / b7 / tmp_obj_6wi717,O_RDWR | O_CREAT | O_EXCL,0444)= - 1 EACCES(权限被拒绝)
[pid 31303] write(2,error:insufficient permission f...,88error:将对象添加到存储库数据库.git / objects
我无法理解已更改的内容,也不明白为什么git试图在标记为RDRW的444(为所有人阅读)读/写?)。
我在archlinux上使用git 1.8.5.1和samba 4.1.3-1,samba服务器是一个windows(git 1.8.4-1并没有解决问题即使我在使用它的过程中仍然有效)
我已阅读其他SO问题,如 Git over samba - 无法写入sha1文件名|权限被拒绝而没有发现任何关于如何解决问题的提示。
你可以看到各种方式来调试在在samba共享上调试git repo权限:
- 为共享设置不同的权限
- 手动安装
- 将samba和git降级到早期版本
- sudo - 这个方法可行,但我不想使用它,除非绝对必要
- 在使用sudo后更改所有者和组
Andrew Myers 建议确保您的裸回购包含core.sharedRepository 设置为组。
如果没有,请设置并运行
cd /path/to/repo.git
chgrp -R groupname。
chmod -R g + rwX。
找到。 -type d -exec chmod g + s'{}'+
不是与内核版本相关的问题:
我已将内核降级到3.11.6,并且在用户再次开始工作时git add / commit。
更新: OP kamaradclimber 报告(或试图)这是一个 内核问题(错误66251) :
在将内核从3.11.6升级到3.12.1之后,在samba共享上正常工作
由这个补丁。
I have used git trough samba for several times without any issue.
In the last days however, it seems impossible to git all/fetch/commit
The error is :
error: insufficient permission for adding an object to repository database .git/objects
Using strace I can see that error is due to a call on open:
[pid 31303] open(".git/objects/b7/tmp_obj_6wi717", O_RDWR|O_CREAT|O_EXCL, 0444) = -1 EACCES (Permission denied)
[pid 31303] write(2, "error: insufficient permission f"..., 88error: insufficient permission for adding an object to repository database .git/objects
I cannot understand what has changed nor why git is trying to open a file in 444 (read for everybody) with the flag RDRW (read/write ?).
I use git 1.8.5.1 and samba 4.1.3-1 on archlinux, the samba server is a windows (git 1.8.4-1 does not solve the issue even if I used it while it was still working)
I have read other SO questions such as Git over samba - unable to write sha1 filename | Permission denied without finding any hint on how to solve the issue.
You can see various way to debug this in "Debugging git repo permissions on samba share":
- setting different permissions for share
- mounting manually
- downgrading samba and git to earlier versions
- sudo - this works but I wouldn't want to use it unless absolutely necessary
- changing owner and group after using sudo
Andrew Myers suggests making sure your bare repo has core.sharedRepository set to group.
If not, set it and run
cd /path/to/repo.git
chgrp -R groupname .
chmod -R g+rwX .
find . -type d -exec chmod g+s '{}' +
If nothing works, make sure it isn't an issue related to the kernel version:
I've downgraded kernel to 3.11.6 and git add/commit as user started working again.
Update: The OP kamaradclimber reports (or tried to) that is was a kernel issue (bug 66251):
Git doesn't work correctly on samba share after upgrading kernel from 3.11.6 to 3.12.1
Fixed by this patch.
这篇关于通过桑巴Git不能获取/添加/提交了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!