Git不适用于Ubuntu→Windows Samba共享目录 [英] Git not working with Ubuntu → Windows Samba shared directory

查看:211
本文介绍了Git不适用于Ubuntu→Windows Samba共享目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个Virtual Box Ubuntu VM,并在其中设置了我的git存储库。然后我使用Samba创建一个共享文件夹,并在smb.conf中进行以下配置

  path = / home / allan / git_repo 
有效用户= allan
只读= no
隐藏点文件= no

当我导航到适当的网络位置时( \\192.168.65.101\git_repo ),我会看到我的所有文件和文件夹,包括我的。 git文件夹,这似乎包含我需要的一切。

如果我导航到我的bash终端(MINGW64)中的网络位置,我发现它不被识别为git存储库。一个简单的命令如 git rev-parse HEAD 返回 fatal:不是git仓库(或任何父目录):.git
另一方面,导航子目录级别会导致某种类型的识别(例如,我可以运行 git rev-parse HEAD 并获取有效的回应)。有很多功能,但我需要在上面的目录中,所以我很困惑发生了什么以及我如何解决这个问题。 解决方案

确保不要在 .git 文件夹中执行你的git命令。

如果应该在 .git / 的父文件夹中执行。



另外,请务必使用适用于Windows的 Git的最新版本,因为它有更好的支持 \\ ... 路径。

另请参阅 // HEAD ,导致Cygwin出现巨大延迟


I am running a Virtual Box Ubuntu VM where I set up my git repository. I then used Samba to create a shared folder and have the following configuration in smb.conf

path = /home/allan/git_repo
valid users = allan
read only = no
hide dot files = no

When I navigate to the appropriate network location (\\192.168.65.101\git_repo) I see all of my files and folders there, including my .git folder which seems to contain everything that I need.

If I navigate to the network location in my bash terminal (MINGW64) I find that it is not recognized as a git repository. A simple command like git rev-parse HEAD returns fatal: Not a git repository (or any of the parent directories): .git On the other hand, navigating a sub-directory level down causes some sort of recognition (e.g. I can run git rev-parse HEAD and get the valid response). There are plenty of functions though for which I need to be at the upper directory so I'm confused what is happening and how I can solve this issue.

解决方案

Make sure to not execute your git command in the .git folder itself.

If should be execute in the parent folder of the .git/.

Also, make sure to use the latest version of Git for Windows, as it has a better support of \\... path.
See also "git tries to stat //HEAD when searching for a repo, leading to huge delays on Cygwin".

这篇关于Git不适用于Ubuntu→Windows Samba共享目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆