How can I change my MinGW/MSYS + mintty home directory?

Unlike Cygwin, MSYS relies on the HOME environment variable. To set or change your HOME variable:

  1. Press Win-r on your keyboard or select "Run…" from the Start menu.
  2. Type "sysdm.cpl" and click OK.
  3. Select the Advanced tab and click Environment Variables…
  4. Click New… to create a new HOME variable or select the existing one and click Edit…
  5. When finished, keep clicking OK until all windows are closed.

The solution for MSYS2 is creating/updating /etc/nsswitch.conf with a line

db_home: windows

as described in Cygwin docs: https://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-mapping-nsswitch-home.

After that all MSYS applications and terminals must be closed, as the configuration is only read once at MSYS DLL load time. (See https://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-mapping-nsswitch.)

As of Oct, 2019, it works for me in a fresh installation of MSYS2. Probably, in MSYS 1 nsswitch.conf was not supported.

Creating HOME environment variable works for shell, but does not work for ssh, which tries to access /home/User/.ssh anyway.