{"thread":{"id":"23240","subject":"Can't assign user.name to \"E F\" in git config","startedAt":"2010-03-29T20:32:55Z","lastAt":"2010-03-29T20:55:59Z","messageCount":2,"participants":["Disc Magnet","Avery Pennarun"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"138129","messageId":"308d4701003291332s500cbbci68e10a784ac1aa81@mail.gmail.com","threadId":"23240","inReplyTo":null,"subject":"Can't assign user.name to \"E F\" in git config","fromName":"Disc Magnet","fromEmail":"discmagnet@gmail.com","sentAt":"2010-03-29T20:32:55Z","receivedAt":"2010-03-29T20:32:55Z","isPatch":false,"sender":{"key":"discmagnet@gmail.com","avatar":null},"body":"I've never done a git init and I don't have any .git directory in the\ncurrent directory. I get warnings in the following example. Moreover,\nI can't assign user.name to \"E F\".\n\nhumpty@wall:~/work$ rm ~/.gitconfig\nhumpty@wall:~/work$ git config --global user.name A B\nhumpty@wall:~/work$ git config --global user.name C D\nhumpty@wall:~/work$ git config --global user.name \"E F\"\nwarning: user.name has multiple values\nhumpty@wall:~/work$ git config -l\nuser.name=A\nuser.name=C\nhumpty@wall:~/work$ cat ~/.gitconfig\n[user]\n        name = A\n        name = C\n\nHowever, everything works fine here.\n\nhumpty@wall:~/work$ rm ~/.gitconfig\nhumpty@wall:~/work$ git config --global user.name A\nhumpty@wall:~/work$ git config --global user.name C\nhumpty@wall:~/work$ git config --global user.name \"E F\"\nhumpty@wall:~/work$ git config -l\nuser.name=E F\nhumpty@wall:~/work$ cat ~/.gitconfig\n[user]\n        name = E F\n\nThe same behavior can be reproduced after doing git init and by\nremoving the --global option.\n\nIs this an expected behavior or is it a bug?\n"},{"id":"138131","messageId":"32541b131003291355k5f93b251vded347e37315fee5@mail.gmail.com","threadId":"23240","inReplyTo":"308d4701003291332s500cbbci68e10a784ac1aa81@mail.gmail.com","subject":"Re: Can't assign user.name to \"E F\" in git config","fromName":"Avery Pennarun","fromEmail":"apenwarr@gmail.com","sentAt":"2010-03-29T20:55:59Z","receivedAt":"2010-03-29T20:55:59Z","isPatch":false,"sender":{"key":"apenwarr@gmail.com","avatar":"https://avatars.githubusercontent.com/u/20592?v=4"},"body":"On Mon, Mar 29, 2010 at 4:32 PM, Disc Magnet <discmagnet@gmail.com> wrote:\n> I've never done a git init and I don't have any .git directory in the\n> current directory. I get warnings in the following example. Moreover,\n> I can't assign user.name to \"E F\".\n\nTake a look at 'man git-config' and search for \"value_regex\".  The\nbehaviour is incredibly non-obvious, but git-config is working as\ndocumented:\n\n> humpty@wall:~/work$ rm ~/.gitconfig\n> humpty@wall:~/work$ git config --global user.name A B\n> humpty@wall:~/work$ git config --global user.name C D\n> humpty@wall:~/work$ git config --global user.name \"E F\"\n> warning: user.name has multiple values\n> humpty@wall:~/work$ git config -l\n> user.name=A\n> user.name=C\n> humpty@wall:~/work$ cat ~/.gitconfig\n> [user]\n>        name = A\n>        name = C\n\nThe A B line means \"remove any user.name options containing B and then\nadd A\".  Similarly with C D.  But the \"E F\" line means \"there is only\none value of user.name, and it should be E F.\"  At that time,\nuser.name has more than one value, so git assumes you've made a\nmistake and refuses to perform the operation (which would have\nresulted in potentially many lost lines of config information).\n\nYou can fix it with \"git config --global --unset-all user.name\".\n\n> However, everything works fine here.\n>\n> humpty@wall:~/work$ rm ~/.gitconfig\n> humpty@wall:~/work$ git config --global user.name A\n> humpty@wall:~/work$ git config --global user.name C\n> humpty@wall:~/work$ git config --global user.name \"E F\"\n> humpty@wall:~/work$ git config -l\n> user.name=E F\n> humpty@wall:~/work$ cat ~/.gitconfig\n> [user]\n>        name = E F\n\nIn the above, you never created multiple values, because the first two\nlines didn't have extra parameters.\n\n> Is this an expected behavior or is it a bug?\n\nI didn't know about it before, and to be honest, it seems a little\ninsane.  But I found it by reading the man page, so it's clearly\n\"expected\" behaviour, in the sense that we're told to expect it.  And\nnow that it exists, removing it would break backward compatibility.\n\nHave fun,\n\nAvery\n"}]}