Tormod
Tormod

Reputation: 4573

Is there a way to make git ignore your HOME setting?

At work, HOME is set to point at a network drive. This drive is not available when I am outside the office.

One of the strengths of git is its distributed nature. But if I run git commands when I am not connected to corporate network then git complains that it cannot access my HOME folder to check git settings.

I hope to avoid setting environment settings back and forth when I am going in and out of office, but I attempted running cmd.exe to change the HOME environment variable in the set command and then run the bash start from the CMD window.

"C:\Program Files (x86)\Git\bin\sh.exe" --login -i

I suspect that the act of logging in reset the variable because it still complained.

I only need to be working with the local repository when I am off the corporate network, if that opens up more options for me.

Any ideas?

Upvotes: 1

Views: 104

Answers (1)

Rufflewind
Rufflewind

Reputation: 8966

Run the following in Command Prompt:

set HOME=location of your choice
"C:\Program Files (x86)\Git\bin\sh.exe" --login -i

Note that the location must be specified using Windows's path syntax and without quotes (e.g. C:\Users\Tormod). MSYS Bash automatically converts them into POSIX-like paths.

Now that you're in Bash, run:

ls -d "$HOME"

and see if it matches up what you originally set it. If not, then it's likely your .bashrc or .bash_profile is overwriting the environment variables.

Upvotes: 1

Related Questions