使用终端和 MacFusion 时出现 GIT_DISCOVERY_ACROSS_FILESYSTEM 问题

发布于 2024-11-30 17:28:44 字数 556 浏览 0 评论 0原文

我使用 MacFusion 和 OSXFuse(类似于 MacFuse)通过 SSH 将我的服务器安装到我的办公室计算机上。当我 cd 进入服务器上的 Rails 工作目录时,我在 zsh 提示符中看不到任何 git 信息。如果我尝试 git pull origin,我会收到以下错误消息:

fatal: Not a git repository (or any parent up to mount parent /Volumes)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set)

我知道我可以 ssh 到服务器,但这样我不会丢失 zsh 自动更正和结果吗?历史?难道我还需要设置textmate等软件才能使用ssh吗?我不需要远程桌面来安装 DMG 等吗?所有这些看起来都有点麻烦。

有没有更好的方法来做我想做的事?否则有没有办法启用 GIT_DISCOVERY_ACROSS_FILESYSTEM?

PS - MacFusion 还可以通过 FTP 安装服务器 - 这会比 SSH 更好吗?

I'm using MacFusion with OSXFuse(similar to MacFuse) to mount my server over SSH onto my office machine. When I cd into my rails work directory on the server, i can't see any git info in my zsh prompt. If i try a git pull origin, i get the following error message:

fatal: Not a git repository (or any parent up to mount parent /Volumes)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set)

I know I can ssh to the server but then wouldn't I lose zsh autocorrection & history? Wouldn't I also need to set up textmate and other software to use ssh? And wouldn't I need to remote desktop to install DMG's and so on? All of that seems like a bit of a hassle.

Is there a better way to do what I want to do? Otherwise is there a way to enable GIT_DISCOVERY_ACROSS_FILESYSTEM?

PS - MacFusion can also mount the server over FTP - would that be preferable to SSH?

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

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

发布评论

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

评论(6

兔小萌 2024-12-07 17:28:44

我收到此错误,直到我意识到我没有在已安装的流浪机器上的该文件夹中初始化 Git 存储库。

所以我输入了 git init 然后 git 就开始工作了。

I got this error until I realized that I hadn't intialized a Git repository in that folder, on a mounted vagrant machine.

So I typed git init and then git worked.

太阳公公是暖光 2024-12-07 17:28:44

您是否正在 ssh 到工作树内的目录?如果 ssh 挂载点的根目录不包含 .git 目录,则 zsh 将无法找到 git 信息。确保您安装的内容包含存储库的根目录。

至于GIT_DISCOVERY_ACROSS_FILESYSTEM,它不会做你想要的事情。默认情况下,Git 将停止在文件系统边界处。如果你打开它(它只是一个环境变量),那么 git 将跨越文件系统边界并继续查找。但是,这几乎没有用,因为您暗示本地计算机上有一个 .git 目录,该目录在某种程度上用于管理部分由 sshfs 安装组成的工作树。这没有多大意义。

Are you ssh'ing to a directory that's inside your work tree? If the root of your ssh mount point doesn't include the .git dir, then zsh won't be able to find git info. Make sure you're mounting something that includes the root of the repo.

As for GIT_DISCOVERY_ACROSS_FILESYSTEM, it doesn't do what you want. Git by default will stop at a filesystem boundary. If you turn that on (and it's just an env var), then git will cross the filesystem boundary and keep looking. However, that's almost never useful, because you'd be implying that you have a .git directory on your local machine that's somehow meant to manage a work tree that's comprised partially of an sshfs mount. That doesn't make much sense.

木有鱼丸 2024-12-07 17:28:44

如果 git 无权读取配置文件,您也会收到此消息。它只会在层次结构树中向上移动,直到需要跨文件系统为止。

You will also get this if git doesn't have permissions to read the config files. It will just go up in the hierarchy tree until it needs to cross file systems.

养猫人 2024-12-07 17:28:44

从第一次 Google 搜索到这里:

您可以通过导出 GIT_DISCOVERY_ACROSS_FILESYSTEM=1 来关闭行为 AND 和警告。

在 Heroku 上,如果您 heroku config:set GIT_DISCOVERY_ACROSS_FILESYSTEM=1 警告就会消失。

这可能是因为您正在从源代码构建 gem,并且 gemspec shell 到 git,就像今天的许多人所做的那样。因此,您仍然会收到警告 fatal: Not a git repository (or any of theparent paths): .git 但要改天再解决这个问题:)

我的答案是重复的:
- 评论 使用终端时出现 GIT_DISCOVERY_ACROSS_FILESYSTEM 问题和MacFusion

Coming here from first Google hit:

You can turn off the behavior AND and warning by exporting GIT_DISCOVERY_ACROSS_FILESYSTEM=1.

On heroku, if you heroku config:set GIT_DISCOVERY_ACROSS_FILESYSTEM=1 the warning will go away.

It's probably because you are building a gem from source and the gemspec shells out to git, like many do today. So, you'll still get the warning fatal: Not a git repository (or any of the parent directories): .git but addressing that is for another day :)

My answer is a duplicate of:
- comment GIT_DISCOVERY_ACROSS_FILESYSTEM problem when working with terminal and MacFusion

沩ん囻菔务 2024-12-07 17:28:44

我的问题是我不在刚刚克隆的正确 git 目录中。

My Problem was that I was not in the correct git directory that I just cloned.

会发光的星星闪亮亮i 2024-12-07 17:28:44

尝试不同的协议。例如,git:// 可能存在来自您的防火墙的问题;尝试使用 https: 进行 git 克隆。

Try a different protocol. git:// may have problems from your firewall, for example; try a git clone with https: instead.

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