If i run Git bash from Git Extention (CTRL+G), my home directory is %USERPROFILE%, which is ok.
If I run Git bash from the context menu of a git repo folder, or if I run Git bash from the start menu, my home directory is %HOME%, which is different.
How can I set up git bash to always use %USERPROFILE% as home directory (I have the .ssh folder within) ?
If it can help, on git bash run from Git Ext, I have :
$ echo $HOME
/c/Users/mylogin
Same command on git bash run directly :
$ echo $HOME
/h
h:
is my corporate home directory
What can I do ?
Git GUI is part of the Git installation, along with Git Bash. Git Extensions is built on top of Git.
To change this current working directory, you can use the "cd" command (where "cd" stands for "change directory"). For example, to move one directory upwards (into the current folder's parent folder), you can just call: $ cd ..
Git is a version control system that lets developers track source code changes during software development. Git Bash is an application for Microsoft Windows, allowing developers to use Git in a command-line interface.
Example 01: Check Current Working Directory The cd command in Git Bash allows you to move within the directories, probably from the current directory to another directory. The command “cd” means “change directory.” The cd command can be widely used in any Linux system's shells (cmd) for the same purpose.
The git bash provided with msysgit in its repo is a script you can edit, in order to set HOME
to %USERPROFILE%
.
It is basically what it does by default, except if HOME
is already defined, the git bash script won't modify that value (but you can, if you edit said script).
I suspect that, in your corporate environment, HOME
is defined to a network drive, in order for various configuration files (maven, ssh, ...) to be stored on a remote, secure and backed-up drive.
That would explain why HOME
is not changed by the Git bash script.
The Git Extension obviously isn't as careful as the first script, and will change/define whatever value it needs.
As the OP Steve B comments:
The HOME
is set, for the Git bash, in etc/profile
:
# Set up USER's home directory
if [ -z "$HOME" -o ! -d "$HOME" ]; then
HOME="$HOMEDRIVE$HOMEPATH"
if [ -z "$HOME" -o ! -d "$HOME" ]; then
HOME="$USERPROFILE"
fi
fi
I removed the first candidate home location, and it works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With