guberm / tortoisegit

Automatically exported from code.google.com/p/tortoisegit
0 stars 0 forks source link

Global .gitconfig when running elevated #2434

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. In our company we have %HOMEDRIVE% and %HOMEPATH% set to a network disk that 
is mounted as a drive.
2. Open an elevated Tortoise Git window, e.g. by right clicking the Settings 
and choosing "Run as administrator"
3. The global gitconfig will now be inaccessible since the network disk is not 
mounted for the elevated process.

What is the expected output? What do you see instead?
msysgit will detect that this paths is inaccessible and set %HOME% to 
%USERPROFILE% instead of %HOMEDRIVE%. This is done on line 37-43 in the 
installed /etc/profile . I expect TortoiseGit to use the same global config 
file as msysgit, which also means that the file will be in a location that is 
accessible to the elevated process.

The error message that I get is "Saving config failed (...)." libgit2 returned: 
Failed to create locked file 'R://.gitconfig.lock': The system cannot find the 
path specified."

What version of TortoiseGit and msysgit are you using? On
what operating system?
TortoiseGit 1.8.13.0
msysgit version 1.9.5-preview20141217
Windows 7 SP1

Please provide any additional information below.
This affects us since we need to run our development Visual Studio elevated in 
order to debug our program which itself runs elevated. An elevated TortoiseGit 
being unable to handle global settings means that every time we open it from 
Visual Studio we will be unable to do anything since the config file is not 
accessible (the most common commands need to have name/email set)

Original issue reported on code.google.com by fred...@glyph.se on 23 Feb 2015 at 11:57

GoogleCodeExporter commented 9 years ago
In your case, is %USERPROFILE% accessible to you?

Original comment by ch3co...@gmail.com on 23 Feb 2015 at 1:10

GoogleCodeExporter commented 9 years ago
Another thing is that the fallback code is in bash only.
git.exe does not have such fallback code in msysgit/git.git: compat/mingw.c: 
get_windows_home_directory()
So I suspect if git.exe works without Git Bash.

And our gitdll.c has a copy of get_windows_home_directory() which comes from 
msysgit.

Original comment by ch3co...@gmail.com on 23 Feb 2015 at 1:15

GoogleCodeExporter commented 9 years ago
Yes, %USERPROFILE% points to a place on the C-disk, so it is accessible also 
when running elevated.

You are correct that it only works in Git Bash, not when running from the 
regular cmd.

Original comment by fred...@glyph.se on 24 Feb 2015 at 8:55

GoogleCodeExporter commented 9 years ago
I don't think that we need to take action here.

Maybe a workaround for you is to disable UAC or set %HOME% explicitely.

Original comment by sstrickr...@googlemail.com on 28 Feb 2015 at 8:58

GoogleCodeExporter commented 9 years ago
The workaround in my case will be to set the EnableLinkedConnections registry 
key which I recently found. See here: 
https://technet.microsoft.com/en-us/library/ee844140%28v=ws.10%29.aspx (I 
haven't tried it yet)

Disabling UAC is not an option since setting it on all our developer computers 
in the company will have too high impact.

For the same reason setting %HOME% might impact other programs in an unexpected 
way.

Original comment by fred...@glyph.se on 28 Feb 2015 at 11:49