1

I installed Git on Windows 10 which also installed git-bash. When I started git-bash, I noticed I was not in my home directory which I expected to be /C/Users/chris/ The path was /C/adwHome

I found that git-bash home "~" is determined first by the environment variable HOME. Another program on my system Cadence Allegro PCB Designer set the HOME environment variable to HOME=C:\adwHome so I cannot change the HOME variable without breaking the other program.

The link Change the location of the ~ directory in a Windows install of Git Bash told me to add this line 'HOME="C:\Users\chris\git"' to my "profile" file located at C:\Program Files\Git\etc\profile. This seemed to work because when I opened a new git-bash window I started in the correct directory.

However when I ran the ssh-keygen command I saw the output line Created directory '/c/adwHome/.ssh'. I think git-bash is changing the home setting from the line in the file "profile" but any executable files launched by git-bash are still getting home set from the environment variable.

Is there a way to change my git-bash "~" location without changing my HOME environment variable?

cmjansen
  • 11
  • 2
  • 1
    Possible duplicate of [How do I change the default location for Git Bash on Windows?](https://stackoverflow.com/questions/7671461/how-do-i-change-the-default-location-for-git-bash-on-windows) – Roman Marusyk Aug 06 '19 at 21:28
  • Your solution might be already sufficient, as `ssh-keygen` probably will be used not very often. Setting HOME directory for `ssh-keygen` via parameter is described here: https://superuser.com/questions/1004254/how-can-i-change-the-directory-that-ssh-keygen-outputs-to – Renat Aug 06 '19 at 21:32

0 Answers0