简体   繁体   English

使用网络驱动器作为git存储库

[英]Using a network drive as git repository

So, I've created a git repository on the networked drive: 所以,我在网络驱动器上创建了一个git存储库:

git init --bare --shared

and that works fine. 这很好。 Then, I clone it to a local drive with 然后,我将它克隆到本地驱动器

git clone z:/testgit

and that also works fine. 这也很好。 Then I add a file, stage, and commit 然后我添加一个文件,阶段和提交

git stage *
git commit -m "test commit"

and that ALSO works fine. 并且ALSO工作正常。 BUT! 但! When I try to push to the origin, I get this error. 当我尝试推送到原点时,我收到此错误。

git push origin
Counting objects: 3, done.
Writing objects: 100% (3/3), 225 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: error: unable to write sha1 filename ./objects/f3/e6e90a7465421306fae05c18153260973542e3: Permission denied
remote: fatal: failed to write object
error: unpack failed: unpack-objects abnormal exit
To z:/testgit14
 ! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to 'z:/testgit'

When attempting to use git stage * directly on the server (on a non --bare git project) I get similar errors. 当试图直接在服务器上使用git stage *(在非裸git项目上)时,我得到类似的错误。

I have full access to the drive in file explorer, and even able to initialize the repository with git. 我可以完全访问文件资源管理器中的驱动器,甚至可以使用git初始化存储库。 SSH shouldn't even apply here since it's not a server, it's a networked drive. SSH甚至不应该在这里应用,因为它不是服务器,它是一个网络驱动器。 Everything I've read about git says that this should work. 我读过的关于git的一切都说这应该有效。 I've read dozens of "how to's" that all say these exact steps, but no one complaining about permission denied, UNLESS they're talking about SSH public keys missing on servers (which, as I've said, shouldn't apply). 我已经阅读了几十个“如何做”,所有人都说这些确切的步骤,但没有人抱怨权限被拒绝,除非他们谈论服务器上缺少SSH公钥(正如我所说,不应该适用)。

What permissions am I missing? 我缺少什么权限? Where should I look for and set the proper permissions? 我应该在哪里寻找并设置适当的权限?

What happens when you try to create the file that git is complaining about? 当你尝试创建git抱怨的文件时会发生什么?

echo test > ./objects/f3/e6e90a7465421306fae05c18153260973542e3

It's possible that git is creating a new folder ( f3 ) and the folder is not getting the correct permissions, either due to ACL inheritance misconfiguration or because the local machine is trying to adjust the permissions on newly created folders and getting it wrong. git可能正在创建一个新文件夹( f3 ),并且该文件夹未获得正确的权限,这可能是由于ACL继承配置错误,或者是因为本地计算机正在尝试调整新创建的文件夹的权限并导致错误。

If it were Linux, it could be because the network drive was connected with the wrong mount options, or the umask was set incorrectly, but I'm not sure whether those are available to be changed on a Windows machine. 如果它是Linux,可能是因为网络驱动器连接错误的挂载选项,或者umask设置不正确,但我不确定是否可以在Windows机器上更改它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM