Git“无法确定git目录的绝对路径" [英] Git "unable to determine absolute path of git directory"

查看:32
本文介绍了Git“无法确定git目录的绝对路径"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 git 新手,在尝试获取远程项目的最新版本时遇到问题:

I'm a git newbie and am having problems trying to get the latest version of a remote project:

S:devprjmyprj [master]> git pull
/usr/libexec/git-core/git-sh-setup: line 266: cd: .git: No such file or directory
Unable to determine absolute path of git directory

直到今天它运行良好,奇怪的是,自从上次运行良好以来,我认为我没有改变任何东西.

It was working fine until today and strangely I don't think I've changed anything since it last worked fine.

这是在 Windows 7 上.我的项目位于加密驱动器 (S:) 上,而 git 位于 C: 上

This is on Windows 7. My project is on an encrypted drive (S:) and git is on C:

S:devprjmyprj [master]> git --exec-path    
C:UsersmattAppDataLocalGitHubPortableGit_656cc1ef6d04f06ddf8b2f5bedbac921caed3b62/libexec/git-core

手动执行 cd 到上面的 exec 目录可以正常工作(即使有混合斜杠类型).

Manually doing a cd to the exec directory above works fine (even though there are mixed slash types).

有什么想法可以开始找出问题所在吗?

Any ideas how to even start working out what has gone wrong?

推荐答案

找到解决方案/解决方法!万岁!

Found the solution/workaround! Hurrah!

我曾经(现在仍然)使用 GitHub for Windows,偶尔它会要求我去 Windows Powershell 修复存储库,因为有时它无法自动修复,有时它会因上述错误消息而失败.

I was (and still am) using GitHub for Windows, and occasionally it asks me to go to Windows Powershell to fix the repository because sometimes it can't do it automatically, and occasionally it would fail with the above error message.

对我来说失败的原因不仅仅是我的项目位于加密驱动器上,更重要的是,有时我会在安装加密驱动器(我手动安装)之前启动 GitHub for Windows.即使我随后关闭 GitHub for Windows,然后挂载加密驱动器,然后重新启动 GitHub for Windows,它仍然会返回上述错误,所以当我关闭 GitHub for Windows 时,可能并非所有 GitHubby 都被关闭.

The reason it was failing for me was not just that my project was on an encrypted drive but, more importantly, that sometimes I would start GitHub for Windows before mounting the encrypted drive (which I manually mount). Even if I then close GitHub for Windows, then mount the encrypted drive, and then relaunch GitHub for Windows it would still come back with the above error, so perhaps not everything GitHubby is being shut down when I close GitHub for Windows.

我的解决方法是:

  1. 重启
  2. 安装包含项目的驱动器
  3. 启动 GitHub for Windows

...按这个顺序.

这篇关于Git“无法确定git目录的绝对路径"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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