{"thread":{"id":"37367","subject":"Location of git config on Windows","startedAt":"2014-08-17T20:18:23Z","lastAt":"2014-08-18T18:17:26Z","messageCount":11,"participants":["Daniel Corbe","Jason Pyeron","Erik Faye-Lund","Karsten Blees"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"247825","messageId":"ygfvbpqooog.fsf@corbe.net","threadId":"37367","inReplyTo":null,"subject":"Location of git config on Windows","fromName":"Daniel Corbe","fromEmail":"corbe@corbe.net","sentAt":"2014-08-17T20:18:23Z","receivedAt":"2014-08-17T20:18:23Z","isPatch":false,"sender":{"key":"corbe@corbe.net","avatar":null},"body":"\nI installed git on my Windows machine while it was connected to my\ncorporate network.  It picked up on that fact and used a mapped drive to\nstore its configuration file.  \n\nAs a result, I cannot currently use git when disconnected from my\nnetwork.  It throws the following error message: fatal: unable to access\n'Z:\\/.config/git/config': Invalid argument\n\nObviously this value is stored in the registry somewhere because I made\nan attempt to uninstall and reinstall git with the same results.  \n\nCan someone give me some guidance here?\n\nBest,\nDaniel\n\nP.S. A screenshot for reference: http://i.imgur.com/i9lm0Da.png\n"},{"id":"247826","messageId":"C9491BC51199409292463C10D606F256@black","threadId":"37367","inReplyTo":"ygfvbpqooog.fsf@corbe.net","subject":"RE: Location of git config on Windows","fromName":"Jason Pyeron","fromEmail":"jpyeron@pdinc.us","sentAt":"2014-08-17T21:40:56Z","receivedAt":"2014-08-17T21:40:56Z","isPatch":false,"sender":{"key":"jpyeron@pdinc.us","avatar":"https://gravatar.com/avatar/c2e53452caa53d940768a1ffc9cf76196d851b9b534b7a39cd39852a70a0508f?d=mp&s=160"},"body":"> -----Original Message-----\n> From: Daniel Corbe\n> Sent: Sunday, August 17, 2014 16:18\n> \n> \n> I installed git on my Windows machine while it was connected to my\n> corporate network.  It picked up on that fact and used a \n> mapped drive to\n> store its configuration file.  \n> \n> As a result, I cannot currently use git when disconnected from my\n> network.  It throws the following error message: fatal: \n> unable to access\n> 'Z:\\/.config/git/config': Invalid argument\n\nAs a workaround, use subst command to map the Z: to another path on your system.\n\nDepending on your OS and your git usage patterns you may have to perform the operation twice at both non-privilged and priviliged prompts.\n\nEx: \n\n subst z: c:\\Users\\corbed\\cached-z-drive\n\n> \n> Obviously this value is stored in the registry somewhere \n> because I made\n> an attempt to uninstall and reinstall git with the same results.  \n> \n> Can someone give me some guidance here?\n> \n\n-Jason \n\n--\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n-                                                               -\n- Jason Pyeron                      PD Inc. http://www.pdinc.us -\n- Principal Consultant              10 West 24th Street #100    -\n- +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -\n-                                                               -\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nThis message is copyright PD Inc, subject to license 20080407P00.\n"},{"id":"247827","messageId":"CABPQNSZDizccths0b_RZ5FXYYq=+4_2N35DMj9h4Rha_2voekw@mail.gmail.com","threadId":"37367","inReplyTo":"ygfvbpqooog.fsf@corbe.net","subject":"Re: Location of git config on Windows","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2014-08-17T22:01:45Z","receivedAt":"2014-08-17T22:01:45Z","isPatch":false,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Sun, Aug 17, 2014 at 10:18 PM, Daniel Corbe <corbe@corbe.net> wrote:\n>\n> I installed git on my Windows machine while it was connected to my\n> corporate network.  It picked up on that fact and used a mapped drive to\n> store its configuration file.\n>\n> As a result, I cannot currently use git when disconnected from my\n> network.  It throws the following error message: fatal: unable to access\n> 'Z:\\/.config/git/config': Invalid argument\n>\n> Obviously this value is stored in the registry somewhere because I made\n> an attempt to uninstall and reinstall git with the same results.\n>\n> Can someone give me some guidance here?\n\nGit looks for the per-user configuration in $HOME/.gitconfig, and if\n$HOME is not set, it falls back to $HOMEDIR/$HOMEPATH/.gitconfig. My\nguess would be some of these environment variables are incorrectly set\non your system.\n"},{"id":"247828","messageId":"53F135F8.60508@gmail.com","threadId":"37367","inReplyTo":"CABPQNSZDizccths0b_RZ5FXYYq=+4_2N35DMj9h4Rha_2voekw@mail.gmail.com","subject":"Re: Location of git config on Windows","fromName":"Karsten Blees","fromEmail":"karsten.blees@gmail.com","sentAt":"2014-08-17T23:08:40Z","receivedAt":"2014-08-17T23:08:40Z","isPatch":false,"sender":{"key":"karsten.blees@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1111200?v=4"},"body":"Am 18.08.2014 00:01, schrieb Erik Faye-Lund:\n> On Sun, Aug 17, 2014 at 10:18 PM, Daniel Corbe <corbe@corbe.net> wrote:\n>>\n>> I installed git on my Windows machine while it was connected to my\n>> corporate network.  It picked up on that fact and used a mapped drive to\n>> store its configuration file.\n>>\n>> As a result, I cannot currently use git when disconnected from my\n>> network.  It throws the following error message: fatal: unable to access\n>> 'Z:\\/.config/git/config': Invalid argument\n>>\n>> Obviously this value is stored in the registry somewhere because I made\n>> an attempt to uninstall and reinstall git with the same results.\n>>\n>> Can someone give me some guidance here?\n> \n> Git looks for the per-user configuration in $HOME/.gitconfig, and if\n> $HOME is not set, it falls back to $HOMEDIR/$HOMEPATH/.gitconfig. My\n> guess would be some of these environment variables are incorrectly set\n> on your system.\n\nTo be precise, git checks if %HOME% is set _and_ the directory exists before\nfalling back to %HOMEDRIVE%%HOMEPATH%.\n\nIf %HOMEDRIVE%%HOMEPATH% isn't set or the directory doesn't exist either, it\nfalls back to %USERPROFILE%, which is always local (C:/Users/<yourname>), even\nif disconnected from the network (at least that's how its supposed to be).\n"},{"id":"247846","messageId":"ygflhqlvni7.fsf@corbe.net","threadId":"37367","inReplyTo":"53F135F8.60508@gmail.com","subject":"Re: Location of git config on Windows","fromName":"Daniel Corbe","fromEmail":"corbe@corbe.net","sentAt":"2014-08-18T15:14:08Z","receivedAt":"2014-08-18T15:14:08Z","isPatch":false,"sender":{"key":"corbe@corbe.net","avatar":null},"body":"\nKarsten Blees <karsten.blees@gmail.com> writes:\n\n> Am 18.08.2014 00:01, schrieb Erik Faye-Lund:\n>> On Sun, Aug 17, 2014 at 10:18 PM, Daniel Corbe <corbe@corbe.net> wrote:\n>>>\n>>> I installed git on my Windows machine while it was connected to my\n>>> corporate network.  It picked up on that fact and used a mapped drive to\n>>> store its configuration file.\n>>>\n>>> As a result, I cannot currently use git when disconnected from my\n>>> network.  It throws the following error message: fatal: unable to access\n>>> 'Z:\\/.config/git/config': Invalid argument\n>>>\n>>> Obviously this value is stored in the registry somewhere because I made\n>>> an attempt to uninstall and reinstall git with the same results.\n>>>\n>>> Can someone give me some guidance here?\n>> \n>> Git looks for the per-user configuration in $HOME/.gitconfig, and if\n>> $HOME is not set, it falls back to $HOMEDIR/$HOMEPATH/.gitconfig. My\n>> guess would be some of these environment variables are incorrectly set\n>> on your system.\n>\n> To be precise, git checks if %HOME% is set _and_ the directory exists before\n> falling back to %HOMEDRIVE%%HOMEPATH%.\n>\n> If %HOMEDRIVE%%HOMEPATH% isn't set or the directory doesn't exist either, it\n> falls back to %USERPROFILE%, which is always local (C:/Users/<yourname>), even\n> if disconnected from the network (at least that's how its supposed to be).\n>\n>\n\nAwesome!  Thanks for the advice. \n\n%HOMEDRIVE% and %HOMEPATH% are indeed set by my system and point to an\n (often disconnected) network drive.  I manually forced %HOME% to\n %USERPROFILE% and it works like a charm now.  \n\nI would argue that on Windows %USERPROFILE% should be checked first (or\nat least after %HOME%).\n\nBest,\nDaniel\n"},{"id":"247839","messageId":"CABPQNSZ=BKqNPCWUmaCSz+gJtBRhjkWtpcDbirsV+KJX=c0kpg@mail.gmail.com","threadId":"37367","inReplyTo":"ygflhqlvni7.fsf@corbe.net","subject":"Re: Location of git config on Windows","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2014-08-18T15:25:20Z","receivedAt":"2014-08-18T15:25:20Z","isPatch":false,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Mon, Aug 18, 2014 at 5:14 PM, Daniel Corbe <corbe@corbe.net> wrote:\n>\n> Karsten Blees <karsten.blees@gmail.com> writes:\n>\n>> Am 18.08.2014 00:01, schrieb Erik Faye-Lund:\n>>> On Sun, Aug 17, 2014 at 10:18 PM, Daniel Corbe <corbe@corbe.net> wrote:\n>>>>\n>>>> I installed git on my Windows machine while it was connected to my\n>>>> corporate network.  It picked up on that fact and used a mapped drive to\n>>>> store its configuration file.\n>>>>\n>>>> As a result, I cannot currently use git when disconnected from my\n>>>> network.  It throws the following error message: fatal: unable to access\n>>>> 'Z:\\/.config/git/config': Invalid argument\n>>>>\n>>>> Obviously this value is stored in the registry somewhere because I made\n>>>> an attempt to uninstall and reinstall git with the same results.\n>>>>\n>>>> Can someone give me some guidance here?\n>>>\n>>> Git looks for the per-user configuration in $HOME/.gitconfig, and if\n>>> $HOME is not set, it falls back to $HOMEDIR/$HOMEPATH/.gitconfig. My\n>>> guess would be some of these environment variables are incorrectly set\n>>> on your system.\n>>\n>> To be precise, git checks if %HOME% is set _and_ the directory exists before\n>> falling back to %HOMEDRIVE%%HOMEPATH%.\n>>\n>> If %HOMEDRIVE%%HOMEPATH% isn't set or the directory doesn't exist either, it\n>> falls back to %USERPROFILE%, which is always local (C:/Users/<yourname>), even\n>> if disconnected from the network (at least that's how its supposed to be).\n>>\n>>\n>\n> Awesome!  Thanks for the advice.\n>\n> %HOMEDRIVE% and %HOMEPATH% are indeed set by my system and point to an\n>  (often disconnected) network drive.  I manually forced %HOME% to\n>  %USERPROFILE% and it works like a charm now.\n>\n> I would argue that on Windows %USERPROFILE% should be checked first (or\n> at least after %HOME%).\n\nWhy? Then people won't be able to have their config files on network-shares, no?\n\nI think a somewhat better approach would be to resolve the home\ndirectory lazily, unless %HOME% is set. That way we can check that\n%HOMEDRIVE%%HOMEPATH% actually exists as it's being accessed. Or you\ncould just restart your shell when you disconnect...\n"},{"id":"247841","messageId":"ygf7g25vm9v.fsf@corbe.net","threadId":"37367","inReplyTo":"CABPQNSZ=BKqNPCWUmaCSz+gJtBRhjkWtpcDbirsV+KJX=c0kpg@mail.gmail.com","subject":"Re: Location of git config on Windows","fromName":"Daniel Corbe","fromEmail":"corbe@corbe.net","sentAt":"2014-08-18T15:40:44Z","receivedAt":"2014-08-18T15:40:44Z","isPatch":false,"sender":{"key":"corbe@corbe.net","avatar":null},"body":"\nErik Faye-Lund <kusmabite@gmail.com> writes:\n\n> Or you could just restart your shell when you disconnect...\n\nWell I'm not that daft.  I tried that and if it had resolved my problem\nI wouldn't have posted.\n"},{"id":"247842","messageId":"CABPQNSZayAr0jf9C55wtEH_AJ_hSUkwFsGV4ZxVixizthojkRA@mail.gmail.com","threadId":"37367","inReplyTo":"ygf7g25vm9v.fsf@corbe.net","subject":"Re: Location of git config on Windows","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2014-08-18T15:47:47Z","receivedAt":"2014-08-18T15:47:47Z","isPatch":false,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Mon, Aug 18, 2014 at 5:40 PM, Daniel Corbe <corbe@corbe.net> wrote:\n>\n> Erik Faye-Lund <kusmabite@gmail.com> writes:\n>\n>> Or you could just restart your shell when you disconnect...\n>\n> Well I'm not that daft.  I tried that and if it had resolved my problem\n> I wouldn't have posted.\n\nHm, but isn't that what Karsten explains in his last paragraph? What\nshell are you running msys or cmd?\n"},{"id":"247843","messageId":"CABPQNSZGYDnSfyS7X+MdskhUrmFx5Kzoi+A5+pgoBiX5kPruyg@mail.gmail.com","threadId":"37367","inReplyTo":"CABPQNSZayAr0jf9C55wtEH_AJ_hSUkwFsGV4ZxVixizthojkRA@mail.gmail.com","subject":"Re: Location of git config on Windows","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2014-08-18T15:51:56Z","receivedAt":"2014-08-18T15:51:56Z","isPatch":false,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Mon, Aug 18, 2014 at 5:47 PM, Erik Faye-Lund <kusmabite@gmail.com> wrote:\n> On Mon, Aug 18, 2014 at 5:40 PM, Daniel Corbe <corbe@corbe.net> wrote:\n>>\n>> Erik Faye-Lund <kusmabite@gmail.com> writes:\n>>\n>>> Or you could just restart your shell when you disconnect...\n>>\n>> Well I'm not that daft.  I tried that and if it had resolved my problem\n>> I wouldn't have posted.\n>\n> Hm, but isn't that what Karsten explains in his last paragraph? What\n> shell are you running msys or cmd?\n\nOur /etc/profile does this:\n\nhttps://github.com/msysgit/msysgit/blob/master/etc/profile#L38\n\n...however, our git-wrapper only does this:\n\nhttps://github.com/msysgit/msysgit/blob/master/src/git-wrapper/git-wrapper.c#L71\n\nSo yeah, we don't seem to actually check if %HOMEDRIVE%%HOMEPATH%\nexists. Perhaps fixing this is the right thing to do then? Since the\ngit-wrapper is run for *every* invokation of git, you wouldn't even\nhave to restart the shell in this case.\n"},{"id":"247851","messageId":"ygfsiktu3rl.fsf@corbe.net","threadId":"37367","inReplyTo":"CABPQNSZGYDnSfyS7X+MdskhUrmFx5Kzoi+A5+pgoBiX5kPruyg@mail.gmail.com","subject":"Re: Location of git config on Windows","fromName":"Daniel Corbe","fromEmail":"corbe@corbe.net","sentAt":"2014-08-18T17:05:50Z","receivedAt":"2014-08-18T17:05:50Z","isPatch":false,"sender":{"key":"corbe@corbe.net","avatar":null},"body":"Erik Faye-Lund <kusmabite@gmail.com> writes:\n\n> On Mon, Aug 18, 2014 at 5:47 PM, Erik Faye-Lund <kusmabite@gmail.com> wrote:\n>> On Mon, Aug 18, 2014 at 5:40 PM, Daniel Corbe <corbe@corbe.net> wrote:\n>>>\n>>> Erik Faye-Lund <kusmabite@gmail.com> writes:\n>>>\n>>>> Or you could just restart your shell when you disconnect...\n>>>\n>>> Well I'm not that daft.  I tried that and if it had resolved my problem\n>>> I wouldn't have posted.\n>>\n>> Hm, but isn't that what Karsten explains in his last paragraph? What\n>> shell are you running msys or cmd?\n>\n> Our /etc/profile does this:\n>\n> https://github.com/msysgit/msysgit/blob/master/etc/profile#L38\n>\n> ...however, our git-wrapper only does this:\n>\n> https://github.com/msysgit/msysgit/blob/master/src/git-wrapper/git-wrapper.c#L71\n>\n> So yeah, we don't seem to actually check if %HOMEDRIVE%%HOMEPATH%\n> exists. Perhaps fixing this is the right thing to do then? Since the\n> git-wrapper is run for *every* invokation of git, you wouldn't even\n> have to restart the shell in this case.\n\nBut again, restarting the shell doesn't fix the problem.  \n\n-Daniel\n"},{"id":"247854","messageId":"CABPQNSbqT1CO3tXn7S3DA88BuEQpz__5D1e4gJLvYeZZy0Ztzg@mail.gmail.com","threadId":"37367","inReplyTo":"ygfsiktu3rl.fsf@corbe.net","subject":"Re: Location of git config on Windows","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2014-08-18T18:17:26Z","receivedAt":"2014-08-18T18:17:26Z","isPatch":false,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Mon, Aug 18, 2014 at 7:05 PM, Daniel Corbe <corbe@corbe.net> wrote:\n> Erik Faye-Lund <kusmabite@gmail.com> writes:\n>\n>> On Mon, Aug 18, 2014 at 5:47 PM, Erik Faye-Lund <kusmabite@gmail.com> wrote:\n>>> On Mon, Aug 18, 2014 at 5:40 PM, Daniel Corbe <corbe@corbe.net> wrote:\n>>>>\n>>>> Erik Faye-Lund <kusmabite@gmail.com> writes:\n>>>>\n>>>>> Or you could just restart your shell when you disconnect...\n>>>>\n>>>> Well I'm not that daft.  I tried that and if it had resolved my problem\n>>>> I wouldn't have posted.\n>>>\n>>> Hm, but isn't that what Karsten explains in his last paragraph? What\n>>> shell are you running msys or cmd?\n>>\n>> Our /etc/profile does this:\n>>\n>> https://github.com/msysgit/msysgit/blob/master/etc/profile#L38\n>>\n>> ...however, our git-wrapper only does this:\n>>\n>> https://github.com/msysgit/msysgit/blob/master/src/git-wrapper/git-wrapper.c#L71\n>>\n>> So yeah, we don't seem to actually check if %HOMEDRIVE%%HOMEPATH%\n>> exists. Perhaps fixing this is the right thing to do then? Since the\n>> git-wrapper is run for *every* invokation of git, you wouldn't even\n>> have to restart the shell in this case.\n>\n> But again, restarting the shell doesn't fix the problem.\n>\n\nNot for cmd, no. But for Git Bash, it should.\n"}]}