我也见过这个。这是一个 git 缺陷,可能与它如何创建和修改文件有关。为了澄清问题:
# mount a samba share locally.
$ mount -t cifs options //share/project /mnt/project
# The share contains a git checkout.
# Do some typical development.
$ cd /mnt/project
$ vi file ## ok
$ git pull ## ok
$ git status ## ok
$ git add file ## error!
error: unable to create temporary sha1 filename
.git/objects/8b/tmp_obj_mYE1Xi: Permission denied
## But everything from the shell seems to work.
$ ls -latr .git/objects/8b/ ## ok. empty dir.
$ touch .git/objects/8b/tmp_obj_mYE1Xi ## ok.
$ echo test123> .git/objects/8b/tmp_obj_mYE1Xi ## ok.
$ cat .git/objects/8b/tmp_obj_mYE1Xi ## ok.
test123
$ rm .git/objects/8b/tmp_obj_mYE1Xi ## ok.
在 git 版本 1.5.6.5(最新的 Debian 软件包)中,当您尝试git-add
. 如果你安装了 git 1.7.3.2(最新版本),你可以添加文件,但是当你尝试提交时会报错。