Git diff-“工作树中没有这样的路径”

时间:2019-01-28 04:34:24

标签: git git-diff

除了修改文件并尝试执行git diff之外,我的git repo中的所有内容都可以正常工作,我会收到此错误-

fatal: 1b9cc4afe763304c97f95bc8e272ebce7a034e59: no such path in the working tree.
Use 'git <command> -- <path>...' to specify paths that do not exist locally.
  • 操作系统:MAC OS 10.13.6
  • Git版本:git version 2.17.2 (Apple Git-113)
  • 这是我的仓库:https://github.com/tusharmath/tusharmath.github.io
  • 分支名称:develop

仅克隆和编辑文件不会让我执行git diff

更新

我尝试使用Github Desktop APP,并且在那里一切正常。

1 个答案:

答案 0 :(得分:0)

  

我认为这是因为我安装了git。我可能搞砸了。 –

首先尝试将您的Git更新到最新的2.20.1版本,确保它位于/usr/local/git/bin/git

explained here

  

如果您已经安装了Xcode并且已经安装了命令行工具,那么您已经拥有了Git(可能是随Xcode一起分发的较旧版本),它将安装在优先于以下位置的路径中:

/usr/bin/git

因此,请确保您的PATH首先选择您的Git:

export PATH="/usr/local/bin:/usr/bin/git:/usr/bin:/usr/local/sbin:$PATH"