Search code examples
windowsgitbackslash

Git for Windows can`t solve backslash '\' in path address


I have installed Git 2.30, and selected all the default recommended options, but it doesn't seem to be able to access the .gitconfig file at my home directory, as the address has a backslash \.

The command returns a error message that ignores the \ character, concatenating the following string.

Git Bash screenshot

As you can see, it concatenates the directories aidmin (admin user) with git folder, completely ignoring the backslash.

Said error appears on Git Bash, CMD and Powershell.
Should I reinstall with Unix formatting?
Also, unfortunately I can`t install other OS in this machine.


Solution

  • First, 2.3 is old, try and install the latest Git For Windows (2.30.0(2))

    Second, check what $HOME looks like.

    It should be /c/Users/admim, or, in a CMD, it (%HOME%) should be set to %USERPROFILE%.
    If not, in your bash session, try for testing to export HOME:

    export HOME=/c/Users/admim
    git config --global user.name "xxx"