5

I'm using Portable Git, but it still creates some files in my user home folder. I would like complete portability.

I followed this answer and set the HOME variable to point to the folder I created, PortableGit\home\user (where PortableGit is my Git installation folder). Now I'm discovering that the .minttyrc configuration file that's created after I change the font size is still being stored in my user home folder, instead of \home\user.

How do I make it so git-bash stores and runs the configuration files for MinTTY in my specified folder instead?

Changing the HOME variable successfully worked for the global .gitconfig file. With this Portable Git installation, I'll be working both on repos on my computer, as well as repos located on my USB, if that information matters...

vegzh
  • 61
  • 2
  • 4

2 Answers2

2

Consider the mintty wiki Tips:

For its configuration file, it reads /etc/minttyrc, $APPDATA/mintty/config, ~/.config/mintty/config, ~/.minttyrc, in this order.

For resource files to configure a colour scheme, wave file for the bell character, or localization files, it looks for subfolders themes, sounds, or lang, respectively, in one of the directories ~/.mintty, ~/.config/mintty, $APPDATA/mintty, /usr/share/mintty, whichever is found first.

The ~/.config/mintty folder is the XDG default base directory. The $APPDATA/mintty folder is especially useful to share common configuration for various installations of mintty (e.g. cygwin 32/64 Bit, MSYS, Git Bash).

In your case, try and move the C:\User\<yourLogin>\.minttyrc to the right HOME folder and see if it is taken into account by launching again a bash session.
Make sure HOME has been defined as a User environment variable, and that you open a new Window, in order to inherit said environment variable new value.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I tried removing `.minttyrc` from `C:\User\` and adding it to the `HOME` folder, but git-bash didn't appear to recognize it as still shows the default font size instead of the one I set. Running `echo $HOME` in the git-bash window does show the newly set home folder path. – vegzh Nov 18 '17 at 20:53
  • @vegzh Just for testing, can you move that same config file and rename it to `$APPDATA/mintty/config`, jsut to see if that is taken into account? – VonC Nov 18 '17 at 20:56
1

Sorry to necro this old post, but I couldn't see a solution anywhere else, and this might be of use to someone.


Note: Adding a HOME path to the PROFILE file in C:\Program Files\Git\etc does not relocate/re-path .minttyrc from the default installation folder. Instead you need to set a Windows Environmental Variable


This applies to Windows 10 Pro, Git 2.34.1

Let's say I want my .minttyrc to be read by Git Bash in C:\Users\Administrator\git instead of the default installation location, which for me is C:\Users\Administrator

  1. Open Control Panel

  2. In the Search box (top right on my screen), type: Advanced system settings

  3. Then under the 'System' heading, click 'View advanced system settings'

  4. A System Properties box will open, with the Advanced tab selected

  5. At the bottom of this box, click Environment Variables. The Environment Variables box will open.

  6. If you are just adding a $home variable for yourself, then click 'New' under 'User Variables'

  • Variable Name: HOME
  • Variable Value: Path to your custom git folder where you want .minttyrc to be located (for me, this is C:\Users\Administrator\git)
  1. On a multi-user system, click 'New' under 'System Variables'
  • Variable Name: HOME
  • Variable Value: %USERPROFILE%\path-to-your-custom-git-folder (for me, I would add: %USERPROFILE%\git)

Now Git Bash will read and store configuration settings in .minttyrc in your custom Git folder

Note: You might need to be careful setting HOME in the System Variables - I'm unsure if other software might also use the HOME variable


Alternative: You can set a global 'minttyrc' by creating a file called minttyrc (no extension) in the folder C:\Program Files\Git\etc

Using this alternative method you can avoid setting Environmental Variables, but the settings in minttyrc at this location will apply globally

psychicEgg
  • 11
  • 2