tusharmath
tusharmath

Reputation: 11002

Git diff — "no such path in the working tree"

Everything in my git repo works perfectly fine except when I modify a file and try to do a git diff, I get this error —

fatal: 1b9cc4afe763304c97f95bc8e272ebce7a034e59: no such path in the working tree.
Use 'git <command> -- <path>...' to specify paths that do not exist locally.

Just clone and editing the file doesn't let me perform a git diff.

UPDATE

I tried using the Github Desktop APP, and everything works fine there.

Upvotes: 4

Views: 2430

Answers (1)

VonC
VonC

Reputation: 1328712

I think its because of my git installation. Something that I might have messed up. –

Try first and update your Git to the latest 2.20.1 version, making sure it is in /usr/local/git/bin/git

As explained here:

If you have Xcode already installed and have installed command line tools then you already have Git, probably an older version which is distributed with Xcode, this is installed in a path that takes precedence at:

/usr/bin/git

So make sure your PATH will select your Git first:

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

Upvotes: 1

Related Questions