Monday, December 30, 2019

How to change the default location for Git Bash on Windows

Setting HOME environment variable in your Windows system can do the trick.  It works for not only Git Bash but also GNU Emacs.  I have used this HOME environment variable for many Linux-like applications since Windows XP and it always works.  The following steps are using Windows 10 as our example.

On Windows 10,

  • Type "edit env" at the desktop search box
  • Select and open Edit environment variables for your account
  • Select Environment Variables... on the "Advanced" Tab of System Properties popup (see the picture below)
  • Create either User or System variable; the example below is using User variable
  • Enter HOME in the "Variable Name" textbox; the name is case insensitive; thus home, HoMe and the like are the same.
  • Enter your path in "Variable value" textbox; the value is also case insensitive. 
  • Click OK twice to confirm and exit
Restart your Git Bash.  The home path will be updated accordingly as well as it will be shown in the title of Git Bash window.



No comments:

Post a Comment