git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Location of git config on Windows
@ 2014-08-17 20:18 Daniel Corbe
  2014-08-17 21:40 ` Jason Pyeron
  2014-08-17 22:01 ` Erik Faye-Lund
  0 siblings, 2 replies; 11+ messages in thread
From: Daniel Corbe @ 2014-08-17 20:18 UTC (permalink / raw)
  To: git


I installed git on my Windows machine while it was connected to my
corporate network.  It picked up on that fact and used a mapped drive to
store its configuration file.  

As a result, I cannot currently use git when disconnected from my
network.  It throws the following error message: fatal: unable to access
'Z:\/.config/git/config': Invalid argument

Obviously this value is stored in the registry somewhere because I made
an attempt to uninstall and reinstall git with the same results.  

Can someone give me some guidance here?

Best,
Daniel

P.S. A screenshot for reference: http://i.imgur.com/i9lm0Da.png

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: Location of git config on Windows
  2014-08-17 20:18 Location of git config on Windows Daniel Corbe
@ 2014-08-17 21:40 ` Jason Pyeron
  2014-08-17 22:01 ` Erik Faye-Lund
  1 sibling, 0 replies; 11+ messages in thread
From: Jason Pyeron @ 2014-08-17 21:40 UTC (permalink / raw)
  To: 'Daniel Corbe', git

> -----Original Message-----
> From: Daniel Corbe
> Sent: Sunday, August 17, 2014 16:18
> 
> 
> I installed git on my Windows machine while it was connected to my
> corporate network.  It picked up on that fact and used a 
> mapped drive to
> store its configuration file.  
> 
> As a result, I cannot currently use git when disconnected from my
> network.  It throws the following error message: fatal: 
> unable to access
> 'Z:\/.config/git/config': Invalid argument

As a workaround, use subst command to map the Z: to another path on your system.

Depending on your OS and your git usage patterns you may have to perform the operation twice at both non-privilged and priviliged prompts.

Ex: 

 subst z: c:\Users\corbed\cached-z-drive

> 
> Obviously this value is stored in the registry somewhere 
> because I made
> an attempt to uninstall and reinstall git with the same results.  
> 
> Can someone give me some guidance here?
> 

-Jason 

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-                                                               -
- Jason Pyeron                      PD Inc. http://www.pdinc.us -
- Principal Consultant              10 West 24th Street #100    -
- +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -
-                                                               -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Location of git config on Windows
  2014-08-17 20:18 Location of git config on Windows Daniel Corbe
  2014-08-17 21:40 ` Jason Pyeron
@ 2014-08-17 22:01 ` Erik Faye-Lund
  2014-08-17 23:08   ` Karsten Blees
  1 sibling, 1 reply; 11+ messages in thread
From: Erik Faye-Lund @ 2014-08-17 22:01 UTC (permalink / raw)
  To: Daniel Corbe; +Cc: GIT Mailing-list

On Sun, Aug 17, 2014 at 10:18 PM, Daniel Corbe <corbe@corbe.net> wrote:
>
> I installed git on my Windows machine while it was connected to my
> corporate network.  It picked up on that fact and used a mapped drive to
> store its configuration file.
>
> As a result, I cannot currently use git when disconnected from my
> network.  It throws the following error message: fatal: unable to access
> 'Z:\/.config/git/config': Invalid argument
>
> Obviously this value is stored in the registry somewhere because I made
> an attempt to uninstall and reinstall git with the same results.
>
> Can someone give me some guidance here?

Git looks for the per-user configuration in $HOME/.gitconfig, and if
$HOME is not set, it falls back to $HOMEDIR/$HOMEPATH/.gitconfig. My
guess would be some of these environment variables are incorrectly set
on your system.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Location of git config on Windows
  2014-08-17 22:01 ` Erik Faye-Lund
@ 2014-08-17 23:08   ` Karsten Blees
  2014-08-18 15:14     ` Daniel Corbe
  0 siblings, 1 reply; 11+ messages in thread
From: Karsten Blees @ 2014-08-17 23:08 UTC (permalink / raw)
  To: kusmabite, Daniel Corbe; +Cc: GIT Mailing-list

Am 18.08.2014 00:01, schrieb Erik Faye-Lund:
> On Sun, Aug 17, 2014 at 10:18 PM, Daniel Corbe <corbe@corbe.net> wrote:
>>
>> I installed git on my Windows machine while it was connected to my
>> corporate network.  It picked up on that fact and used a mapped drive to
>> store its configuration file.
>>
>> As a result, I cannot currently use git when disconnected from my
>> network.  It throws the following error message: fatal: unable to access
>> 'Z:\/.config/git/config': Invalid argument
>>
>> Obviously this value is stored in the registry somewhere because I made
>> an attempt to uninstall and reinstall git with the same results.
>>
>> Can someone give me some guidance here?
> 
> Git looks for the per-user configuration in $HOME/.gitconfig, and if
> $HOME is not set, it falls back to $HOMEDIR/$HOMEPATH/.gitconfig. My
> guess would be some of these environment variables are incorrectly set
> on your system.

To be precise, git checks if %HOME% is set _and_ the directory exists before
falling back to %HOMEDRIVE%%HOMEPATH%.

If %HOMEDRIVE%%HOMEPATH% isn't set or the directory doesn't exist either, it
falls back to %USERPROFILE%, which is always local (C:/Users/<yourname>), even
if disconnected from the network (at least that's how its supposed to be).

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Location of git config on Windows
  2014-08-17 23:08   ` Karsten Blees
@ 2014-08-18 15:14     ` Daniel Corbe
  2014-08-18 15:25       ` Erik Faye-Lund
  0 siblings, 1 reply; 11+ messages in thread
From: Daniel Corbe @ 2014-08-18 15:14 UTC (permalink / raw)
  To: Karsten Blees; +Cc: kusmabite, GIT Mailing-list


Karsten Blees <karsten.blees@gmail.com> writes:

> Am 18.08.2014 00:01, schrieb Erik Faye-Lund:
>> On Sun, Aug 17, 2014 at 10:18 PM, Daniel Corbe <corbe@corbe.net> wrote:
>>>
>>> I installed git on my Windows machine while it was connected to my
>>> corporate network.  It picked up on that fact and used a mapped drive to
>>> store its configuration file.
>>>
>>> As a result, I cannot currently use git when disconnected from my
>>> network.  It throws the following error message: fatal: unable to access
>>> 'Z:\/.config/git/config': Invalid argument
>>>
>>> Obviously this value is stored in the registry somewhere because I made
>>> an attempt to uninstall and reinstall git with the same results.
>>>
>>> Can someone give me some guidance here?
>> 
>> Git looks for the per-user configuration in $HOME/.gitconfig, and if
>> $HOME is not set, it falls back to $HOMEDIR/$HOMEPATH/.gitconfig. My
>> guess would be some of these environment variables are incorrectly set
>> on your system.
>
> To be precise, git checks if %HOME% is set _and_ the directory exists before
> falling back to %HOMEDRIVE%%HOMEPATH%.
>
> If %HOMEDRIVE%%HOMEPATH% isn't set or the directory doesn't exist either, it
> falls back to %USERPROFILE%, which is always local (C:/Users/<yourname>), even
> if disconnected from the network (at least that's how its supposed to be).
>
>

Awesome!  Thanks for the advice. 

%HOMEDRIVE% and %HOMEPATH% are indeed set by my system and point to an
 (often disconnected) network drive.  I manually forced %HOME% to
 %USERPROFILE% and it works like a charm now.  

I would argue that on Windows %USERPROFILE% should be checked first (or
at least after %HOME%).

Best,
Daniel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Location of git config on Windows
  2014-08-18 15:14     ` Daniel Corbe
@ 2014-08-18 15:25       ` Erik Faye-Lund
  2014-08-18 15:40         ` Daniel Corbe
  0 siblings, 1 reply; 11+ messages in thread
From: Erik Faye-Lund @ 2014-08-18 15:25 UTC (permalink / raw)
  To: Daniel Corbe; +Cc: Karsten Blees, GIT Mailing-list

On Mon, Aug 18, 2014 at 5:14 PM, Daniel Corbe <corbe@corbe.net> wrote:
>
> Karsten Blees <karsten.blees@gmail.com> writes:
>
>> Am 18.08.2014 00:01, schrieb Erik Faye-Lund:
>>> On Sun, Aug 17, 2014 at 10:18 PM, Daniel Corbe <corbe@corbe.net> wrote:
>>>>
>>>> I installed git on my Windows machine while it was connected to my
>>>> corporate network.  It picked up on that fact and used a mapped drive to
>>>> store its configuration file.
>>>>
>>>> As a result, I cannot currently use git when disconnected from my
>>>> network.  It throws the following error message: fatal: unable to access
>>>> 'Z:\/.config/git/config': Invalid argument
>>>>
>>>> Obviously this value is stored in the registry somewhere because I made
>>>> an attempt to uninstall and reinstall git with the same results.
>>>>
>>>> Can someone give me some guidance here?
>>>
>>> Git looks for the per-user configuration in $HOME/.gitconfig, and if
>>> $HOME is not set, it falls back to $HOMEDIR/$HOMEPATH/.gitconfig. My
>>> guess would be some of these environment variables are incorrectly set
>>> on your system.
>>
>> To be precise, git checks if %HOME% is set _and_ the directory exists before
>> falling back to %HOMEDRIVE%%HOMEPATH%.
>>
>> If %HOMEDRIVE%%HOMEPATH% isn't set or the directory doesn't exist either, it
>> falls back to %USERPROFILE%, which is always local (C:/Users/<yourname>), even
>> if disconnected from the network (at least that's how its supposed to be).
>>
>>
>
> Awesome!  Thanks for the advice.
>
> %HOMEDRIVE% and %HOMEPATH% are indeed set by my system and point to an
>  (often disconnected) network drive.  I manually forced %HOME% to
>  %USERPROFILE% and it works like a charm now.
>
> I would argue that on Windows %USERPROFILE% should be checked first (or
> at least after %HOME%).

Why? Then people won't be able to have their config files on network-shares, no?

I think a somewhat better approach would be to resolve the home
directory lazily, unless %HOME% is set. That way we can check that
%HOMEDRIVE%%HOMEPATH% actually exists as it's being accessed. Or you
could just restart your shell when you disconnect...

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Location of git config on Windows
  2014-08-18 15:25       ` Erik Faye-Lund
@ 2014-08-18 15:40         ` Daniel Corbe
  2014-08-18 15:47           ` Erik Faye-Lund
  0 siblings, 1 reply; 11+ messages in thread
From: Daniel Corbe @ 2014-08-18 15:40 UTC (permalink / raw)
  To: kusmabite; +Cc: Karsten Blees, GIT Mailing-list


Erik Faye-Lund <kusmabite@gmail.com> writes:

> Or you could just restart your shell when you disconnect...

Well I'm not that daft.  I tried that and if it had resolved my problem
I wouldn't have posted.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Location of git config on Windows
  2014-08-18 15:40         ` Daniel Corbe
@ 2014-08-18 15:47           ` Erik Faye-Lund
  2014-08-18 15:51             ` Erik Faye-Lund
  0 siblings, 1 reply; 11+ messages in thread
From: Erik Faye-Lund @ 2014-08-18 15:47 UTC (permalink / raw)
  To: Daniel Corbe; +Cc: Karsten Blees, GIT Mailing-list

On Mon, Aug 18, 2014 at 5:40 PM, Daniel Corbe <corbe@corbe.net> wrote:
>
> Erik Faye-Lund <kusmabite@gmail.com> writes:
>
>> Or you could just restart your shell when you disconnect...
>
> Well I'm not that daft.  I tried that and if it had resolved my problem
> I wouldn't have posted.

Hm, but isn't that what Karsten explains in his last paragraph? What
shell are you running msys or cmd?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Location of git config on Windows
  2014-08-18 15:47           ` Erik Faye-Lund
@ 2014-08-18 15:51             ` Erik Faye-Lund
  2014-08-18 17:05               ` Daniel Corbe
  0 siblings, 1 reply; 11+ messages in thread
From: Erik Faye-Lund @ 2014-08-18 15:51 UTC (permalink / raw)
  To: Daniel Corbe; +Cc: Karsten Blees, GIT Mailing-list

On Mon, Aug 18, 2014 at 5:47 PM, Erik Faye-Lund <kusmabite@gmail.com> wrote:
> On Mon, Aug 18, 2014 at 5:40 PM, Daniel Corbe <corbe@corbe.net> wrote:
>>
>> Erik Faye-Lund <kusmabite@gmail.com> writes:
>>
>>> Or you could just restart your shell when you disconnect...
>>
>> Well I'm not that daft.  I tried that and if it had resolved my problem
>> I wouldn't have posted.
>
> Hm, but isn't that what Karsten explains in his last paragraph? What
> shell are you running msys or cmd?

Our /etc/profile does this:

https://github.com/msysgit/msysgit/blob/master/etc/profile#L38

...however, our git-wrapper only does this:

https://github.com/msysgit/msysgit/blob/master/src/git-wrapper/git-wrapper.c#L71

So yeah, we don't seem to actually check if %HOMEDRIVE%%HOMEPATH%
exists. Perhaps fixing this is the right thing to do then? Since the
git-wrapper is run for *every* invokation of git, you wouldn't even
have to restart the shell in this case.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Location of git config on Windows
  2014-08-18 15:51             ` Erik Faye-Lund
@ 2014-08-18 17:05               ` Daniel Corbe
  2014-08-18 18:17                 ` Erik Faye-Lund
  0 siblings, 1 reply; 11+ messages in thread
From: Daniel Corbe @ 2014-08-18 17:05 UTC (permalink / raw)
  To: kusmabite; +Cc: Karsten Blees, GIT Mailing-list

Erik Faye-Lund <kusmabite@gmail.com> writes:

> On Mon, Aug 18, 2014 at 5:47 PM, Erik Faye-Lund <kusmabite@gmail.com> wrote:
>> On Mon, Aug 18, 2014 at 5:40 PM, Daniel Corbe <corbe@corbe.net> wrote:
>>>
>>> Erik Faye-Lund <kusmabite@gmail.com> writes:
>>>
>>>> Or you could just restart your shell when you disconnect...
>>>
>>> Well I'm not that daft.  I tried that and if it had resolved my problem
>>> I wouldn't have posted.
>>
>> Hm, but isn't that what Karsten explains in his last paragraph? What
>> shell are you running msys or cmd?
>
> Our /etc/profile does this:
>
> https://github.com/msysgit/msysgit/blob/master/etc/profile#L38
>
> ...however, our git-wrapper only does this:
>
> https://github.com/msysgit/msysgit/blob/master/src/git-wrapper/git-wrapper.c#L71
>
> So yeah, we don't seem to actually check if %HOMEDRIVE%%HOMEPATH%
> exists. Perhaps fixing this is the right thing to do then? Since the
> git-wrapper is run for *every* invokation of git, you wouldn't even
> have to restart the shell in this case.

But again, restarting the shell doesn't fix the problem.  

-Daniel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Location of git config on Windows
  2014-08-18 17:05               ` Daniel Corbe
@ 2014-08-18 18:17                 ` Erik Faye-Lund
  0 siblings, 0 replies; 11+ messages in thread
From: Erik Faye-Lund @ 2014-08-18 18:17 UTC (permalink / raw)
  To: Daniel Corbe; +Cc: Karsten Blees, GIT Mailing-list

On Mon, Aug 18, 2014 at 7:05 PM, Daniel Corbe <corbe@corbe.net> wrote:
> Erik Faye-Lund <kusmabite@gmail.com> writes:
>
>> On Mon, Aug 18, 2014 at 5:47 PM, Erik Faye-Lund <kusmabite@gmail.com> wrote:
>>> On Mon, Aug 18, 2014 at 5:40 PM, Daniel Corbe <corbe@corbe.net> wrote:
>>>>
>>>> Erik Faye-Lund <kusmabite@gmail.com> writes:
>>>>
>>>>> Or you could just restart your shell when you disconnect...
>>>>
>>>> Well I'm not that daft.  I tried that and if it had resolved my problem
>>>> I wouldn't have posted.
>>>
>>> Hm, but isn't that what Karsten explains in his last paragraph? What
>>> shell are you running msys or cmd?
>>
>> Our /etc/profile does this:
>>
>> https://github.com/msysgit/msysgit/blob/master/etc/profile#L38
>>
>> ...however, our git-wrapper only does this:
>>
>> https://github.com/msysgit/msysgit/blob/master/src/git-wrapper/git-wrapper.c#L71
>>
>> So yeah, we don't seem to actually check if %HOMEDRIVE%%HOMEPATH%
>> exists. Perhaps fixing this is the right thing to do then? Since the
>> git-wrapper is run for *every* invokation of git, you wouldn't even
>> have to restart the shell in this case.
>
> But again, restarting the shell doesn't fix the problem.
>

Not for cmd, no. But for Git Bash, it should.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-08-18 18:18 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-17 20:18 Location of git config on Windows Daniel Corbe
2014-08-17 21:40 ` Jason Pyeron
2014-08-17 22:01 ` Erik Faye-Lund
2014-08-17 23:08   ` Karsten Blees
2014-08-18 15:14     ` Daniel Corbe
2014-08-18 15:25       ` Erik Faye-Lund
2014-08-18 15:40         ` Daniel Corbe
2014-08-18 15:47           ` Erik Faye-Lund
2014-08-18 15:51             ` Erik Faye-Lund
2014-08-18 17:05               ` Daniel Corbe
2014-08-18 18:17                 ` Erik Faye-Lund

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).