1

I installed Git 2.28.0 64 bit on windows 10. The default git config is set to my home directory. Since this is a company computer, the HOME is always set to a network folder by Group Policy.

I tryied some suggestions that editing the etc/profile file by setting the HOME variable at the top of the like this:

HOME="/c/Users/MyUserName/Documents"

This trick did not work. My question is how to change this?

Thanks to a few people suggested this Changing .gitconfig location on Windows but it did not help. I have tried the suggestions (except for the Power Script option, which is not an option in my situation) there but still did not work.

Thanks,

user1941319
  • 375
  • 3
  • 19
  • 1
    Does this answer your question? [Changing .gitconfig location on Windows](https://stackoverflow.com/questions/4050905/changing-gitconfig-location-on-windows) – flaxel Sep 25 '20 at 20:09
  • Thanks for pointing that out. I read that already and tried some of the suggestions except for writing a power shell script to update it dynamically - which is not an option. I just wonder the reason behind making this so difficult to set the config location .... ??? – user1941319 Sep 25 '20 at 20:24
  • Does it work if you write `export HOME=foo` instead of just `HOME=foo` in that line? – bk2204 Sep 25 '20 at 23:19
  • What's wrong with having HOME (and in turn `.gitconfig`) set to a network folder? – jingx Sep 26 '20 at 04:22
  • @jingx If I am not connected to the company network, then I cannot access HOME directory. – user1941319 Sep 27 '20 at 15:53
  • If you are allowed to change `/etc` (via local sudo probably), you can put the config in `/etc/gitconfig`, or set `XDG_CONFIG_HOME` to some directory, and put the config in `$XDG_CONFIG_HOME/git/config. See https://git-scm.com/docs/git-config#FILES – jingx Sep 27 '20 at 17:01

1 Answers1

0

I am working on a company computer and can set HOME in my user environment variables to any path I want.

That is enough for Git to switch folder.

That would assume the company does not force the environment variable HOME itself: on Windows 10, the company generally set HOMEDRIVE (not HOME) to a network drive.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • My IT is not as nice as yours :) – user1941319 Sep 28 '20 at 17:19
  • @user1941319 Do you mean they are setting `HOME`, not just `HOMEDRIVE`? And you cannot set your own user environment variables? (I am not talking about system environment variables) – VonC Sep 28 '20 at 19:48