Git"无法确定git目录的绝对路径"

Mat*_*ins 27 git windows-7

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

S:\dev\prj\myprj [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
Run Code Online (Sandbox Code Playgroud)

它工作正常,直到今天,奇怪的是,我认为我没有改变任何东西,因为它最后工作正常.

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

S:\dev\prj\myprj [master]> git --exec-path    
C:\Users\matt\AppData\Local\GitHub\PortableGit_656cc1ef6d04f06ddf8b2f5bedbac921caed3b62/libexec/git-core
Run Code Online (Sandbox Code Playgroud)

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

任何想法如何开始解决出错的问题?

Nik*_*iou 36

杀死ssh-agent.exe进程对我有用.
注:这就是所谓sh.exe在SourceTree(感谢@cowlinator)的新版本

  • 通过在PowerShell中输入以下内容,这对我也有用:`Stop-Process -processname ssh-agent*`后跟`git pull` (3认同)
  • 在较新版本的SourceTree中似乎被称为"sh.exe". (3认同)

Mat*_*ins 26

找到解决方案/解决方法!欢呼!

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

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

我的解决方法是:

  1. 重启
  2. Mount Drive包含项目
  3. 启动GitHub for Windows

...以该顺序.


Ana*_*tts 5

您最有可能使用PowerShell和映射的网络驱动器.PowerShell"帮助"撤消映射,因此传递给Git的目录是Git不理解的UNC路径.

  • 一个简单的黑客解决方法是在PowerShell中输入'cmd',执行'git pull',然后输入'exit'返回PowerShell (4认同)