Ferie
Ferie

Reputation: 1436

Source Tree error: 'git status' failed with code 1: error launching git: the filename or extension is too long

I have used Source Tree with the same repository and the same paths for months (in a Windows environment) then suddenly last Monday, this error has started to appear when the program is opening the repository.

I have already tried with the command line

git config --system core.longpaths true

to avoids the length of the paths in a Windows environment, but it does not wok.

Any idea?

But most important: why it has worked perfectly since the beginning and only now there is this problem?

P.S: the command line is working, I am forced to use this at the moment, but I prefer to use Source Tree in my job.

Upvotes: 3

Views: 4722

Answers (2)

stijn
stijn

Reputation: 35901

While CodeWizard's answer might technically be correct in some cases, in other cases it just seems to be a bug in git by which some versions for Windows are plagued: after installing git 2.20.1 (via chocolatey, if that matters), this error pops up even when running git on the commandline in a root drive (cannot really get any shorter than that) so the error message is very misleading and incorrect in this case. Under msys (via git-bash.exe) the same executable does not produce the error. An earlier version, 2.18.0, installed in the exact same manner on the same machine, does not have the problem though.

tldr; if you get this all the time no matter what the path length is, try a different git version

Upvotes: 0

CodeWizard
CodeWizard

Reputation: 142214

There is nothing you can do about it.

Git for windows has a limit of 260 characters in the file name.
For unix its supporting up to 4096 characters.

The full discussion can be found here. (MAX_PATH) https://github.com/msysgit/git/pull/110

It has nothing to do with Sourcetree its pure git limitation as you can see here as well:
https://gitlab.com/tortoisegit/tortoisegit/issues/1017

Upvotes: 1

Related Questions