简体   繁体   中英

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?

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

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

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

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM