Search code examples
gitsourcetree

bad numeric config value 'tru' for 'core.longpaths': invalid unit


I can't launch repositories on sourcetree.

I get:

bad numeric config value 'tru' for 'core.longpaths': invalid unit

It's happened after I tried to clone a project with a long file name.
And then i tried to enable the "core.longpaths".

How to fix it please?


Solution

  • Simply edit your global git config named .gitconfig in your $HOME (or %USERPROFILE% on Windows)

    You need to replace tru with true or delete core.longpaths altogether from your global settings.

    In command line, you can also type:

    git config --global unset core.longpaths
    cd /path/to/my/repo
    git config core.longpaths true
    

    Checks your SourceTree settings though: make sure it is using the System’s Git and not the embedded one.


    With Git 2.39 (Q4 2022), documentation on various Boolean GIT_* environment variables have been clarified regarding boolean values:

    See commit 819fb68, commit b724df6, commit fd01795, commit 80f0b3f, commit 29491ca (15 Sep 2022) by Junio C Hamano (gitster).
    (Merged by Junio C Hamano -- gitster -- in commit a1fdfb0, 10 Oct 2022)

    environ: explain Boolean environment variables

    Many environment variables use the git_env_bool() API to parse their values, and allow the usual "true/yes/on are true, false/no/off are false.
    In addition non-zero numbers are true and zero is false.
    An empty string is also false." set of values.

    Mark them as such, and consistently say "true" or "false", instead of random mixes of '1', '0', 'yes', 'true', etc.
    in their description.