I would like to use git-bash come with github client on a windows 7 (32bit) machine. Somehow, the git-bash has already learned the $PATH
variables from windows
Why not using absolute path
instead of relative path
and if a folder of file name contains a space just use ""
(quotes).
Ex. cd C:/Users/"My Folder"
git-bash
runs in a Linux
environment. As, linux doesn't recognize \ backslash
in its directory path, you need to use / forwardslash
. Use ""
if you directory path contains spaces.
Basically to confirm what is working: For environment variables use export keyword:
export JAVA_HOME="/c/Program Files/Java/jdkxxxxx"
same for PATH variable etc.
You can put it in your ~/.bashrc . Then, use variables instead of direct string with spaces
Use the bash declare command -
$ declare -x PATH="/path with spaces":$PATH
Put a backslash ("\
") before the space.
ex. cd My\ Documents
The answer for me was close to that of Seagal82.
I added the following line at the start of [PATH_TO_GITBASH_INSTALL]\etc\profile
:
export HOME="/c/Users/Username\ with\ spaces/"
Then I started a new git bash window and all the paths in $PATH
using $HOME
got replaced with the anti-slashed space and work correctly.