Git over samba - 无法写入 sha1 文件名 |没有权限

发布于 2024-09-26 04:09:31 字数 281 浏览 4 评论 0原文

当我在 Windows 上通过 samba 共享使用 git 时,当我想通过 git_extentions 或 tortoiseGIT 提交文件时,会出现错误。 错误是: 错误:无法写入 sha1 文件名 .git/objects/b4/e819f886bf31b67c42249a0eff8e8b16cf7622:权限被拒绝。 当我通过 ubuntu 服务器添加文件并提交文件时,它工作正常。 我也在银行工作。

我已经尝试过 chmod 777 整个 .git 文件夹

When I am using git over samba share on windows I get an error when i want to commit a file via git_extentions or tortoiseGIT.
The error is:
error: unable to write sha1 filename .git/objects/b4/e819f886bf31b67c42249a0eff8e8b16cf7622: Permission denied.
When I add the file via the ubuntu server and commit the file it works fine.
I am also working in a banrch.

I have already tryed chmod 777 the whole .git folder.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

旧故 2024-10-03 04:09:31

我也见过这个。这是 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(最新版本),则可以添加该文件,但尝试提交时会出现错误。

I've seen this, too. It's a git defect, likely to do with how it creates and modifies files. To clarify the problem:

# 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.

In git version 1.5.6.5 (latest Debian package), you get the error when you try to git-add. If you install git 1.7.3.2 (latest release), you can add the file, but you will get the error when you attempt to commit.

给妤﹃绝世温柔 2024-10-03 04:09:31

这个问题以前在 Git/Samba 安装中以某种形式出现过。不确定问题的根源是否已经查明:

http ://code.google.com/p/msysgit/issues/detail?id=130#makechanges

更新:

看起来 git v. 1.7.3.3 已经解决了这个问题。

This issue has been seen before in some form or another for Git/Samba installations. Not sure if the source of the problem has been pin pointed yet:

http://code.google.com/p/msysgit/issues/detail?id=130#makechanges

Update:

looks like git v. 1.7.3.3 has resolved this issue.

西瑶 2024-10-03 04:09:31

好的,我找到了一个适合我的解决方案。

我已经使用 git 而不是 samba (samba-common-3.0.33-3.7.el5) 多年了,没有出现任何问题。

我将 git 升级到 Git-1.7.6-preview20110708,一切都失败了!

由于我是一个有条不紊的开发人员,所以我没有写下我升级的内容!

因此,我浏览了以前的版本列表,并在 Git-1.7.0.2-preview20100309,有点旧,但是穿上它......然后砰......它可以工作!

Ok, I have found a solution that worked for me.

I have been using git over samba (samba-common-3.0.33-3.7.el5) for ages with no problems.

I upgraded git to Git-1.7.6-preview20110708, and it all went to pot!

As Im such a methodical developer, I didnt write down what I upgraded from!

So I went through the list of previous releases and saw a Star next to Git-1.7.0.2-preview20100309, so a bit old, but put that on.... and bang... it works!

凝望流年 2024-10-03 04:09:31

我们今天开始使用git。 1.7.10 版本适用于 win7 机器。在 winXP 上我们发生了给定的错误。对于这些机器,我们将其降级到 1.7.0.2,正如 Ian 在他的帖子中所述,现在可以使用了。

we started to use git today. version 1.7.10 was fine for win7 machines. on winXP we occurred the given error. for those machines we downgraded to 1.7.0.2 as Ian stated in his post and it works now.

甜`诱少女 2024-10-03 04:09:31

也许 samba 会阻止点文件?为什么不使用 ssh 而不是 samba 进行推送呢?

Probably samba blocks dotfiles? Why not use ssh instead of samba for pushing?

过潦 2024-10-03 04:09:31

就我而言,是 Windows 上的防病毒软件锁定了文件。暂时禁用防病毒软件解决了该问题。

In my case it was the anti-virus software on Windows locking the file(s). Temporarily disabling the anti-virus fixed the problem.

烟花肆意 2024-10-03 04:09:31

我也在这里回答了这个问题

在我的例子中,看起来Git(v 2.6.3)试图创建它的拥有 Samba 驱动器的读/写权限。这将阻止包文件和/或对象被写入(解包错误),

remote: error: unable to write sha1 filename ./objects/pack/pack-<some_hex_string>.pack: Permission denied
remote: fatal: cannot store pack file
error: unpack failed: index-pack abnormal exit
To z:\git\<repo name>
 ! [remote rejected] master -> master (unpacker error)
error: failed to push some refs

我来回尝试修复。最后,由于我控制了 Samba 机器,因此我在 samba 驱动器配置中添加了一行,其中显示“继承权限 = yes”。我重新启动 Samba 并尝试推送。成功了!

这对我很有用,因为我是唯一使用 Samba 服务器的人。对于其他人,您可能会尝试“强制目录模式”或“强制创建模式”。您可以在这里找到这些内容的手册页:

https ://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/AccessControls.html

I answered this question over here as well

In my case, it looks like Git (v 2.6.3) tried to create its own read/write permissions on the Samba drive. This would prevent the pack files and/or objects from getting written (unpack error)

remote: error: unable to write sha1 filename ./objects/pack/pack-<some_hex_string>.pack: Permission denied
remote: fatal: cannot store pack file
error: unpack failed: index-pack abnormal exit
To z:\git\<repo name>
 ! [remote rejected] master -> master (unpacker error)
error: failed to push some refs

I went back and forth on trying to fix. Finally, since I had control of the Samba machine, I added a line to the samba drive config, which says "inherit permissions = yes". I restarted Samba and tried to push. It worked!

This worked for me since I'm the only person using the Samba server. For others, you may have the play around with "force directory mode" or "force create mode". You can find the man pages for those over here:

https://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/AccessControls.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文