{"thread":{"id":"27812","subject":"How to force git to use authentication as author","startedAt":"2011-07-14T10:36:38Z","lastAt":"2011-07-14T19:45:52Z","messageCount":15,"participants":["J. Bakshi","Ævar Arnfjörð Bjarmason","Carlos Martín Nieto","Erik Faye-Lund","Ferry Huberts","Jakub Narebski","Jonathan Nieder"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"171313","messageId":"20110714160638.065b6542@shiva.selfip.org","threadId":"27812","inReplyTo":null,"subject":"How to force git to use authentication as author","fromName":"J. Bakshi","fromEmail":"joydeep@infoservices.in","sentAt":"2011-07-14T10:36:38Z","receivedAt":"2011-07-14T10:36:38Z","isPatch":false,"sender":{"key":"joydeep@infoservices.in","avatar":null},"body":"Hello,\n\nI have setup a git repo which is protected with user authentication set by apache it self.\n\n<Location /git>\nAuthType Basic\n# Message to give to the committer\nAuthName \"Write access requires a password\"\n# File listing users with write (commit) access\nAuthUserFile /home/git/PASSWD\nRequire valid-user\n</Location>\n\nNow users are required to use their authentication as per /home/git/PASSWD file ( generated by htpasswd) . How can I force git to use the username as define at /home/git/PASSWD as the author name for git commit ?\n\nThanks\n"},{"id":"171314","messageId":"CACBZZX4X8qRBXqwi70kZ0eZ+mb7rdD6p36xD=GoX6soha0TZcg@mail.gmail.com","threadId":"27812","inReplyTo":"20110714160638.065b6542@shiva.selfip.org","subject":"Re: How to force git to use authentication as author","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2011-07-14T10:38:59Z","receivedAt":"2011-07-14T10:38:59Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Thu, Jul 14, 2011 at 12:36, J. Bakshi <joydeep@infoservices.in> wrote:\n\n> How can I force git to use the username as define at /home/git/PASSWD as the author name for git commit ?\n\nEdit the global bashrc to have:\n\n    export GIT_AUTHOR_NAME=$(cat ~/PASSWD)\n\n?\n"},{"id":"171316","messageId":"20110714161838.1e30893a@shiva.selfip.org","threadId":"27812","inReplyTo":"CACBZZX4X8qRBXqwi70kZ0eZ+mb7rdD6p36xD=GoX6soha0TZcg@mail.gmail.com","subject":"Re: How to force git to use authentication as author","fromName":"J. Bakshi","fromEmail":"joydeep@infoservices.in","sentAt":"2011-07-14T10:48:38Z","receivedAt":"2011-07-14T10:48:38Z","isPatch":false,"sender":{"key":"joydeep@infoservices.in","avatar":null},"body":"On Thu, 14 Jul 2011 12:38:59 +0200\nÆvar Arnfjörð Bjarmason <avarab@gmail.com> wrote:\n\n> On Thu, Jul 14, 2011 at 12:36, J. Bakshi <joydeep@infoservices.in> wrote:\n> \n> > How can I force git to use the username as define at /home/git/PASSWD as the author name for git commit ?\n> \n> Edit the global bashrc to have:\n> \n>     export GIT_AUTHOR_NAME=$(cat ~/PASSWD)\n> \n> ?\n\nThanks. \n\n[1] will it work with file generated by htpasswd ? as that file is actually created by same (/home/git/PASSWD)\n\n[2] And the commit is over http, So is it effective to set the value by .bashrc ?\n"},{"id":"171320","messageId":"1310641202.18730.16.camel@bee.lab.cmartin.tk","threadId":"27812","inReplyTo":"20110714161838.1e30893a@shiva.selfip.org","subject":"Re: How to force git to use authentication as author","fromName":"Carlos Martín Nieto","fromEmail":"cmn@elego.de","sentAt":"2011-07-14T11:00:02Z","receivedAt":"2011-07-14T11:00:02Z","isPatch":false,"sender":{"key":"cmn@elego.de","avatar":"https://avatars.githubusercontent.com/u/335443?v=4"},"body":"On Thu, 2011-07-14 at 16:18 +0530, J. Bakshi wrote:\n> On Thu, 14 Jul 2011 12:38:59 +0200\n> Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:\n> \n> > On Thu, Jul 14, 2011 at 12:36, J. Bakshi <joydeep@infoservices.in>\n> wrote:\n> > \n> > > How can I force git to use the username as define\n> at /home/git/PASSWD as the author name for git commit ?\n> > \n> > Edit the global bashrc to have:\n> > \n> >     export GIT_AUTHOR_NAME=$(cat ~/PASSWD)\n> > \n> > ?\n> \n> Thanks. \n> \n> [1] will it work with file generated by htpasswd ? as that file is\n> actually created by same (/home/git/PASSWD)\n\nNot directly, if it only has one line, then $(cat ~/PASSWD | cut -d ':'\n-f 1) should work, but I haven't tested it.\n\n> \n> [2] And the commit is over http, So is it effective to set the value\n> by .bashrc ?\n\nYou are misunderstanding either how git works or the nomenclature. The\ncommits all happen locally and need no authentication whatsoever (and\nusually you're expected to use a real name and email address). When you\nneed to authenticate is when yuou push your changes somewhere (a central\nrepo, for example). This is where the ~/.netrc file comes into play, as\nI mentioned in the reply to your other mail.\n\nCheers,\n   cmn\n"},{"id":"171323","messageId":"20110714164547.0b359e60@shiva.selfip.org","threadId":"27812","inReplyTo":"1310641202.18730.16.camel@bee.lab.cmartin.tk","subject":"Re: How to force git to use authentication as author","fromName":"J. Bakshi","fromEmail":"joydeep@infoservices.in","sentAt":"2011-07-14T11:15:47Z","receivedAt":"2011-07-14T11:15:47Z","isPatch":false,"sender":{"key":"joydeep@infoservices.in","avatar":null},"body":"On Thu, 14 Jul 2011 13:00:02 +0200\nCarlos Martín Nieto <cmn@elego.de> wrote:\n\n> On Thu, 2011-07-14 at 16:18 +0530, J. Bakshi wrote:\n> > On Thu, 14 Jul 2011 12:38:59 +0200\n> > Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:\n> > \n> > > On Thu, Jul 14, 2011 at 12:36, J. Bakshi <joydeep@infoservices.in>\n> > wrote:\n> > > \n> > > > How can I force git to use the username as define\n> > at /home/git/PASSWD as the author name for git commit ?\n> > > \n> > > Edit the global bashrc to have:\n> > > \n> > >     export GIT_AUTHOR_NAME=$(cat ~/PASSWD)\n> > > \n> > > ?\n> > \n> > Thanks. \n> > \n> > [1] will it work with file generated by htpasswd ? as that file is\n> > actually created by same (/home/git/PASSWD)\n> \n> Not directly, if it only has one line, then $(cat ~/PASSWD | cut -d ':'\n> -f 1) should work, but I haven't tested it.\n> \n> > \n> > [2] And the commit is over http, So is it effective to set the value\n> > by .bashrc ?\n> \n> You are misunderstanding either how git works or the nomenclature. The\n> commits all happen locally and need no authentication whatsoever (and\n> usually you're expected to use a real name and email address). When you\n> need to authenticate is when yuou push your changes somewhere (a central\n> repo, for example). This is where the ~/.netrc file comes into play, as\n> I mentioned in the reply to your other mail.\n> \nExactly, when we need to push we are asked about authentication. I like to configure the central git server in a way so that the user-name as in authentication, be set as author name by the git server itself. actually it is how I configured svn server over http. So comparing to that I am trying to achieve the same. Say your user-name is there at htpasswd file as Carlos, so when you authenticate by Carlos to push , the author-name will automatically become as Carlos. No way to customize that with specific username. That's the idea.\n\nThanks\n"},{"id":"171324","messageId":"1310643482.6041.17.camel@centaur.lab.cmartin.tk","threadId":"27812","inReplyTo":"20110714164547.0b359e60@shiva.selfip.org","subject":"Re: How to force git to use authentication as author","fromName":"Carlos Martín Nieto","fromEmail":"cmn@elego.de","sentAt":"2011-07-14T11:38:02Z","receivedAt":"2011-07-14T11:38:02Z","isPatch":false,"sender":{"key":"cmn@elego.de","avatar":"https://avatars.githubusercontent.com/u/335443?v=4"},"body":"On Thu, 2011-07-14 at 16:45 +0530, J. Bakshi wrote:\n> On Thu, 14 Jul 2011 13:00:02 +0200\n> Carlos Martín Nieto <cmn@elego.de> wrote:\n> \n> > On Thu, 2011-07-14 at 16:18 +0530, J. Bakshi wrote:\n> > > On Thu, 14 Jul 2011 12:38:59 +0200\n> > > Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:\n> > > \n> > > > On Thu, Jul 14, 2011 at 12:36, J. Bakshi <joydeep@infoservices.in>\n> > > wrote:\n> > > > \n> > > > > How can I force git to use the username as define\n> > > at /home/git/PASSWD as the author name for git commit ?\n> > > > \n> > > > Edit the global bashrc to have:\n> > > > \n> > > >     export GIT_AUTHOR_NAME=$(cat ~/PASSWD)\n> > > > \n> > > > ?\n> > > \n> > > Thanks. \n> > > \n> > > [1] will it work with file generated by htpasswd ? as that file is\n> > > actually created by same (/home/git/PASSWD)\n> > \n> > Not directly, if it only has one line, then $(cat ~/PASSWD | cut -d ':'\n> > -f 1) should work, but I haven't tested it.\n> > \n> > > \n> > > [2] And the commit is over http, So is it effective to set the value\n> > > by .bashrc ?\n> > \n> > You are misunderstanding either how git works or the nomenclature. The\n> > commits all happen locally and need no authentication whatsoever (and\n> > usually you're expected to use a real name and email address). When you\n> > need to authenticate is when yuou push your changes somewhere (a central\n> > repo, for example). This is where the ~/.netrc file comes into play, as\n> > I mentioned in the reply to your other mail.\n> > \n> Exactly, when we need to push we are asked about authentication. I\n> like to configure the central git server in a way so that the\n> user-name as in authentication, be set as author name by the git\n> server itself. actually it is how I configured svn server over http.\n> So comparing to that I am trying to achieve the same. Say your\n> user-name is there at htpasswd file as Carlos, so when you\n> authenticate by Carlos to push , the author-name will automatically\n> become as Carlos. No way to customize that with specific username.\n> That's the idea.\n\nThat's not how it works. It may even be possible to rewrite the commits\nin the post-receive hook in a way that most stuff doesn't break\nhorribly, this would be rewriting history behind the users' backs, and\nthat only brings problems.\n\nThe way to set the author name and mail in a standard way, be it\nuser-wide or per-repo. You can write up some simple instructions on how\nto do it.\n\n    git config user.name \"Max Smith\"\n    git config user.mail max.smith@example.com\n\nand if the config should be valid for every repo, use --global flag.\nThere is more information in the manual page.\n\nYou could then add a check in the post-receive hook to reject pushes\nwith invalid author names, if you feel it's worth it.\n\nTaking a step back, why is this even an issue, though? If you don't\ntrust your developers to set their name and email correctly, why do you\ntrust them to write code? If it's company policy for people to be\nreferred to by their usernames rather than their given names, why not\ntell them to set it to that[0]? It seems like you are trying to solve a\nsocial issue with a technological measure that works at a different\nlevel.\n\n[0] and given that they're probably using their company email address,\nit wouldn't be a problem to get a unique ID for each developer if that's\nwhat you need.\n\nCheers,\n   cmn\n"},{"id":"171325","messageId":"20110714170842.073af841@shiva.selfip.org","threadId":"27812","inReplyTo":"20110714164547.0b359e60@shiva.selfip.org","subject":"Re: How to force git to use authentication as author","fromName":"J. Bakshi","fromEmail":"joydeep@infoservices.in","sentAt":"2011-07-14T11:38:42Z","receivedAt":"2011-07-14T11:38:42Z","isPatch":false,"sender":{"key":"joydeep@infoservices.in","avatar":null},"body":"On Thu, 14 Jul 2011 16:45:47 +0530\n\"J. Bakshi\" <joydeep@infoservices.in> wrote:\n\n> On Thu, 14 Jul 2011 13:00:02 +0200\n> Carlos Martín Nieto <cmn@elego.de> wrote:\n> \n> > On Thu, 2011-07-14 at 16:18 +0530, J. Bakshi wrote:\n> > > On Thu, 14 Jul 2011 12:38:59 +0200\n> > > Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:\n> > > \n> > > > On Thu, Jul 14, 2011 at 12:36, J. Bakshi <joydeep@infoservices.in>\n> > > wrote:\n> > > > \n> > > > > How can I force git to use the username as define\n> > > at /home/git/PASSWD as the author name for git commit ?\n> > > > \n> > > > Edit the global bashrc to have:\n> > > > \n> > > >     export GIT_AUTHOR_NAME=$(cat ~/PASSWD)\n> > > > \n> > > > ?\n> > > \n> > > Thanks. \n> > > \n> > > [1] will it work with file generated by htpasswd ? as that file is\n> > > actually created by same (/home/git/PASSWD)\n> > \n> > Not directly, if it only has one line, then $(cat ~/PASSWD | cut -d ':'\n> > -f 1) should work, but I haven't tested it.\n> > \n> > > \n> > > [2] And the commit is over http, So is it effective to set the value\n> > > by .bashrc ?\n> > \n> > You are misunderstanding either how git works or the nomenclature. The\n> > commits all happen locally and need no authentication whatsoever (and\n> > usually you're expected to use a real name and email address). When you\n> > need to authenticate is when yuou push your changes somewhere (a central\n> > repo, for example). This is where the ~/.netrc file comes into play, as\n> > I mentioned in the reply to your other mail.\n> > \n> Exactly, when we need to push we are asked about authentication. I like to configure the central git server in a way so that the user-name as in authentication, be set as author name by the git server itself. actually it is how I configured svn server over http. So comparing to that I am trying to achieve the same. Say your user-name is there at htpasswd file as Carlos, so when you authenticate by Carlos to push , the author-name will automatically become as Carlos. No way to customize that with specific username. That's the idea.\n> \n> Thanks\n> \n\nFollowing the link below, it seems not possible right now\n\nhttp://permalink.gmane.org/gmane.comp.version-control.git/171444\n"},{"id":"171326","messageId":"CABPQNSY3qyQXO4hyM6xhHq2VYhK5369ihuqJ5PDAonN7+UpcGA@mail.gmail.com","threadId":"27812","inReplyTo":"20110714164547.0b359e60@shiva.selfip.org","subject":"Re: How to force git to use authentication as author","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2011-07-14T11:53:23Z","receivedAt":"2011-07-14T11:53:23Z","isPatch":false,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Thu, Jul 14, 2011 at 1:15 PM, J. Bakshi <joydeep@infoservices.in> wrote:\n> On Thu, 14 Jul 2011 13:00:02 +0200 Carlos Martín Nieto <cmn@elego.de> wrote:\n>> You are misunderstanding either how git works or the nomenclature. The\n>> commits all happen locally and need no authentication whatsoever (and\n>> usually you're expected to use a real name and email address). When you\n>> need to authenticate is when yuou push your changes somewhere (a central\n>> repo, for example). This is where the ~/.netrc file comes into play, as\n>> I mentioned in the reply to your other mail.\n>>\n> Exactly, when we need to push we are asked about authentication.\n\nIn Git (as you probably know), authentication is not the same as\nauthorship. Because of the distributed nature of Git, a certain change\ncan reach the repo without going through a central repo (e.g by\nmailing, pushing to a third-party repo etc).\n\nSo to be friendly to different work-flows while retaining authorship,\nauthorship (both of the change itself and of the commit object) needed\nto be decoupled from authentication.\n\n> I like to configure the central git server in a way so that the user-name as in authentication, be set as author name by the git server itself.\n\nThere's no way you can setup this from the server-side. Commits are\ncreated without communication with the server, again due to the\ndistributed nature of Git.\n\nThe only thing you can do at the server-side (and it quickly gets\nugly), is to try to validate the pushed commits through a hook. You\ncould probably verify that the authorship is the same as the\nauthentication, but this breaks distributed work-flows. A slightly\nbetter approach would be to verify the commiter (as opposed to the\npatch-author), as this allows for e-mailed patches to retain the\noriginal authorship. But it still breaks work-flows that use bundles\nor pushing between different repos (and probably more), so it's not\nexactly elegant.\n\nSo let's step back a little bit. Why do you want the author to be\nidentical to the authenticated user in the first place? Is it to be\nable to *prove* (i.e not trust the users that push) who wrote what\ncode? If so, let's me first tell you that giving someone push-access\nwhile not trusting them is a bit crazy. But if you're happy with being\na bit crazy, you'd might want to somehow cryptographically sign the\ncommits instead. I'd go for PGP-signing the patch-id, and putting that\nin a git-note.\n\n> actually it is how I configured svn server over http. So comparing to that I am trying to achieve the same. Say your user-name is there at htpasswd file as Carlos, so when you authenticate by Carlos to push , the author-name will automatically become as Carlos. No way to customize that with specific username. That's the idea.\n\nBeing the same as in SVN is not a good thing in itself. I've\npersonally had lots of pain when moving SVN servers, because users are\na server-local thing (so the repository needs to be rewritten or\nwhatnot). And I'm not even an SVN \"power-user\". The beauty about\nhaving the name + e-mail pair in Git is that the commits do not change\nno matter what. The history stays the same, you just change the\nauthentication.\n"},{"id":"171327","messageId":"CABPQNSbB3RufmY=Vo0-94ErsimsSPx4pCNWudbEGP9kcJHY_vg@mail.gmail.com","threadId":"27812","inReplyTo":"1310643482.6041.17.camel@centaur.lab.cmartin.tk","subject":"Re: How to force git to use authentication as author","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2011-07-14T12:00:06Z","receivedAt":"2011-07-14T12:00:06Z","isPatch":false,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Thu, Jul 14, 2011 at 1:38 PM, Carlos Martín Nieto <cmn@elego.de> wrote:\n> On Thu, 2011-07-14 at 16:45 +0530, J. Bakshi wrote:\n>> On Thu, 14 Jul 2011 13:00:02 +0200\n>> Carlos Martín Nieto <cmn@elego.de> wrote:\n>>\n>> > On Thu, 2011-07-14 at 16:18 +0530, J. Bakshi wrote:\n>> > > On Thu, 14 Jul 2011 12:38:59 +0200\n>> > > Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:\n>> > >\n>> > > > On Thu, Jul 14, 2011 at 12:36, J. Bakshi <joydeep@infoservices.in>\n>> > > wrote:\n>> > > >\n>> > > > > How can I force git to use the username as define\n>> > > at /home/git/PASSWD as the author name for git commit ?\n>> > > >\n>> > > > Edit the global bashrc to have:\n>> > > >\n>> > > >     export GIT_AUTHOR_NAME=$(cat ~/PASSWD)\n>> > > >\n>> > > > ?\n>> > >\n>> > > Thanks.\n>> > >\n>> > > [1] will it work with file generated by htpasswd ? as that file is\n>> > > actually created by same (/home/git/PASSWD)\n>> >\n>> > Not directly, if it only has one line, then $(cat ~/PASSWD | cut -d ':'\n>> > -f 1) should work, but I haven't tested it.\n>> >\n>> > >\n>> > > [2] And the commit is over http, So is it effective to set the value\n>> > > by .bashrc ?\n>> >\n>> > You are misunderstanding either how git works or the nomenclature. The\n>> > commits all happen locally and need no authentication whatsoever (and\n>> > usually you're expected to use a real name and email address). When you\n>> > need to authenticate is when yuou push your changes somewhere (a central\n>> > repo, for example). This is where the ~/.netrc file comes into play, as\n>> > I mentioned in the reply to your other mail.\n>> >\n>> Exactly, when we need to push we are asked about authentication. I\n>> like to configure the central git server in a way so that the\n>> user-name as in authentication, be set as author name by the git\n>> server itself. actually it is how I configured svn server over http.\n>> So comparing to that I am trying to achieve the same. Say your\n>> user-name is there at htpasswd file as Carlos, so when you\n>> authenticate by Carlos to push , the author-name will automatically\n>> become as Carlos. No way to customize that with specific username.\n>> That's the idea.\n>\n> That's not how it works. It may even be possible to rewrite the commits\n> in the post-receive hook in a way that most stuff doesn't break\n> horribly, this would be rewriting history behind the users' backs, and\n> that only brings problems.\n\nThis will (as you point out) only lead to problems, because rewriting\nthe history at commit-time will have the effect that a push leaves you\nin the situation where you end up with a different history on the\nworkstation and the server. All branches off the pushed branch will\nbecome a hell, and a clusterfck of darkness and terror will take over.\n\n> The way to set the author name and mail in a standard way, be it\n> user-wide or per-repo. You can write up some simple instructions on how\n> to do it.\n>\n>    git config user.name \"Max Smith\"\n>    git config user.mail max.smith@example.com\n>\n> and if the config should be valid for every repo, use --global flag.\n> There is more information in the manual page.\n>\n> You could then add a check in the post-receive hook to reject pushes\n> with invalid author names, if you feel it's worth it.\n>\n\nDenying a push is much more elegant than rewriting, but (as I pointed\nout in my other mail) also has a lot of problems with distributed\nwork-flows. And let's face it when changing from SVN to Git, the\ndistributed nature is about the last feature that you'd want to give\nup ;)\n\n> Taking a step back, why is this even an issue, though? If you don't\n> trust your developers to set their name and email correctly, why do you\n> trust them to write code? If it's company policy for people to be\n> referred to by their usernames rather than their given names, why not\n> tell them to set it to that[0]? It seems like you are trying to solve a\n> social issue with a technological measure that works at a different\n> level.\n\nVery well said, I completely agree!\n"},{"id":"171328","messageId":"20110714173129.1116e4b2@shiva.selfip.org","threadId":"27812","inReplyTo":"1310643482.6041.17.camel@centaur.lab.cmartin.tk","subject":"Re: How to force git to use authentication as author","fromName":"J. Bakshi","fromEmail":"joydeep@infoservices.in","sentAt":"2011-07-14T12:01:29Z","receivedAt":"2011-07-14T12:01:29Z","isPatch":false,"sender":{"key":"joydeep@infoservices.in","avatar":null},"body":"On Thu, 14 Jul 2011 13:38:02 +0200\nCarlos Martín Nieto <cmn@elego.de> wrote:\n\n> On Thu, 2011-07-14 at 16:45 +0530, J. Bakshi wrote:\n> > On Thu, 14 Jul 2011 13:00:02 +0200\n> > Carlos Martín Nieto <cmn@elego.de> wrote:\n> > \n> > > On Thu, 2011-07-14 at 16:18 +0530, J. Bakshi wrote:\n> > > > On Thu, 14 Jul 2011 12:38:59 +0200\n> > > > Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:\n> > > > \n> > > > > On Thu, Jul 14, 2011 at 12:36, J. Bakshi <joydeep@infoservices.in>\n> > > > wrote:\n> > > > > \n> > > > > > How can I force git to use the username as define\n> > > > at /home/git/PASSWD as the author name for git commit ?\n> > > > > \n> > > > > Edit the global bashrc to have:\n> > > > > \n> > > > >     export GIT_AUTHOR_NAME=$(cat ~/PASSWD)\n> > > > > \n> > > > > ?\n> > > > \n> > > > Thanks. \n> > > > \n> > > > [1] will it work with file generated by htpasswd ? as that file is\n> > > > actually created by same (/home/git/PASSWD)\n> > > \n> > > Not directly, if it only has one line, then $(cat ~/PASSWD | cut -d ':'\n> > > -f 1) should work, but I haven't tested it.\n> > > \n> > > > \n> > > > [2] And the commit is over http, So is it effective to set the value\n> > > > by .bashrc ?\n> > > \n> > > You are misunderstanding either how git works or the nomenclature. The\n> > > commits all happen locally and need no authentication whatsoever (and\n> > > usually you're expected to use a real name and email address). When you\n> > > need to authenticate is when yuou push your changes somewhere (a central\n> > > repo, for example). This is where the ~/.netrc file comes into play, as\n> > > I mentioned in the reply to your other mail.\n> > > \n> > Exactly, when we need to push we are asked about authentication. I\n> > like to configure the central git server in a way so that the\n> > user-name as in authentication, be set as author name by the git\n> > server itself. actually it is how I configured svn server over http.\n> > So comparing to that I am trying to achieve the same. Say your\n> > user-name is there at htpasswd file as Carlos, so when you\n> > authenticate by Carlos to push , the author-name will automatically\n> > become as Carlos. No way to customize that with specific username.\n> > That's the idea.\n> \n> That's not how it works. It may even be possible to rewrite the commits\n> in the post-receive hook in a way that most stuff doesn't break\n> horribly, this would be rewriting history behind the users' backs, and\n> that only brings problems.\n> \n> The way to set the author name and mail in a standard way, be it\n> user-wide or per-repo. You can write up some simple instructions on how\n> to do it.\n> \n>     git config user.name \"Max Smith\"\n>     git config user.mail max.smith@example.com\n> \n> and if the config should be valid for every repo, use --global flag.\n> There is more information in the manual page.\n> \n> You could then add a check in the post-receive hook to reject pushes\n> with invalid author names, if you feel it's worth it.\n> \n> Taking a step back, why is this even an issue, though? If you don't\n> trust your developers to set their name and email correctly, why do you\n> trust them to write code? If it's company policy for people to be\n> referred to by their usernames rather than their given names, why not\n> tell them to set it to that[0]? It seems like you are trying to solve a\n> social issue with a technological measure that works at a different\n> level.\n> \n\nCertainly not an issue at all. As I have mentioned before it is how the svn repo is working here. \nSo we are trying to follow the same with git too. Without effecting too much of the already running\nenvironment, so that the users need not bother too much with git. But as I have found it is not possible right now\n\nhttp://permalink.gmane.org/gmane.comp.version-control.git/171444\n"},{"id":"171331","messageId":"4E1EDE19.6060109@hupie.com","threadId":"27812","inReplyTo":"20110714173129.1116e4b2@shiva.selfip.org","subject":"Re: How to force git to use authentication as author","fromName":"Ferry Huberts","fromEmail":"mailings@hupie.com","sentAt":"2011-07-14T12:16:25Z","receivedAt":"2011-07-14T12:16:25Z","isPatch":false,"sender":{"key":"mailings@hupie.com","avatar":"https://gravatar.com/avatar/ca355376c0713475e17ae413a49f6b98bcbc54cd8364cab7113c53107fb839bb?d=mp&s=160"},"body":"On 07/14/2011 02:01 PM, J. Bakshi wrote:\n> On Thu, 14 Jul 2011 13:38:02 +0200\n> Carlos Martín Nieto <cmn@elego.de> wrote:\n> \n>> On Thu, 2011-07-14 at 16:45 +0530, J. Bakshi wrote:\n>>> On Thu, 14 Jul 2011 13:00:02 +0200\n>>> Carlos Martín Nieto <cmn@elego.de> wrote:\n>>>\n>>>> On Thu, 2011-07-14 at 16:18 +0530, J. Bakshi wrote:\n>>>>> On Thu, 14 Jul 2011 12:38:59 +0200\n>>>>> Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:\n>>>>>\n>>>>>> On Thu, Jul 14, 2011 at 12:36, J. Bakshi <joydeep@infoservices.in>\n>>>>> wrote:\n>>>>>>\n>>>>>>> How can I force git to use the username as define\n>>>>> at /home/git/PASSWD as the author name for git commit ?\n>>>>>>\n>>>>>> Edit the global bashrc to have:\n>>>>>>\n>>>>>>     export GIT_AUTHOR_NAME=$(cat ~/PASSWD)\n>>>>>>\n>>>>>> ?\n>>>>>\n>>>>> Thanks. \n>>>>>\n>>>>> [1] will it work with file generated by htpasswd ? as that file is\n>>>>> actually created by same (/home/git/PASSWD)\n>>>>\n>>>> Not directly, if it only has one line, then $(cat ~/PASSWD | cut -d ':'\n>>>> -f 1) should work, but I haven't tested it.\n>>>>\n>>>>>\n>>>>> [2] And the commit is over http, So is it effective to set the value\n>>>>> by .bashrc ?\n>>>>\n>>>> You are misunderstanding either how git works or the nomenclature. The\n>>>> commits all happen locally and need no authentication whatsoever (and\n>>>> usually you're expected to use a real name and email address). When you\n>>>> need to authenticate is when yuou push your changes somewhere (a central\n>>>> repo, for example). This is where the ~/.netrc file comes into play, as\n>>>> I mentioned in the reply to your other mail.\n>>>>\n>>> Exactly, when we need to push we are asked about authentication. I\n>>> like to configure the central git server in a way so that the\n>>> user-name as in authentication, be set as author name by the git\n>>> server itself. actually it is how I configured svn server over http.\n>>> So comparing to that I am trying to achieve the same. Say your\n>>> user-name is there at htpasswd file as Carlos, so when you\n>>> authenticate by Carlos to push , the author-name will automatically\n>>> become as Carlos. No way to customize that with specific username.\n>>> That's the idea.\n>>\n>> That's not how it works. It may even be possible to rewrite the commits\n>> in the post-receive hook in a way that most stuff doesn't break\n>> horribly, this would be rewriting history behind the users' backs, and\n>> that only brings problems.\n>>\n>> The way to set the author name and mail in a standard way, be it\n>> user-wide or per-repo. You can write up some simple instructions on how\n>> to do it.\n>>\n>>     git config user.name \"Max Smith\"\n>>     git config user.mail max.smith@example.com\n>>\n>> and if the config should be valid for every repo, use --global flag.\n>> There is more information in the manual page.\n>>\n>> You could then add a check in the post-receive hook to reject pushes\n>> with invalid author names, if you feel it's worth it.\n>>\n>> Taking a step back, why is this even an issue, though? If you don't\n>> trust your developers to set their name and email correctly, why do you\n>> trust them to write code? If it's company policy for people to be\n>> referred to by their usernames rather than their given names, why not\n>> tell them to set it to that[0]? It seems like you are trying to solve a\n>> social issue with a technological measure that works at a different\n>> level.\n>>\n> \n> Certainly not an issue at all. As I have mentioned before it is how the svn repo is working here. \n> So we are trying to follow the same with git too. Without effecting too much of the already running\n> environment, so that the users need not bother too much with git. But as I have found it is not possible right now\n> \n\nAs Erik said:\n\n> This will (as you point out) only lead to problems, because rewriting\n> the history at commit-time will have the effect that a push leaves you\n> in the situation where you end up with a different history on the\n> workstation and the server. All branches off the pushed branch will\n> become a hell, and a clusterfck of darkness and terror will take over.\n\nSVN and Git are _totally_ different models. Do not try to force Git into\nthe svn model, it'll just give you __major__ headaches.\n\nOTOH: It'll teach your users all the advanced uses of Git very rapidly. LOL\n\n> http://permalink.gmane.org/gmane.comp.version-control.git/171444\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n\n\n-- \nFerry Huberts\n"},{"id":"171329","messageId":"20110714174916.07dd314d@shiva.selfip.org","threadId":"27812","inReplyTo":"CABPQNSbB3RufmY=Vo0-94ErsimsSPx4pCNWudbEGP9kcJHY_vg@mail.gmail.com","subject":"Re: How to force git to use authentication as author","fromName":"J. Bakshi","fromEmail":"joydeep@infoservices.in","sentAt":"2011-07-14T12:19:16Z","receivedAt":"2011-07-14T12:19:16Z","isPatch":false,"sender":{"key":"joydeep@infoservices.in","avatar":null},"body":"On Thu, 14 Jul 2011 14:00:06 +0200\nErik Faye-Lund <kusmabite@gmail.com> wrote:\n\n> On Thu, Jul 14, 2011 at 1:38 PM, Carlos Martín Nieto <cmn@elego.de> wrote:\n> > On Thu, 2011-07-14 at 16:45 +0530, J. Bakshi wrote:\n> >> On Thu, 14 Jul 2011 13:00:02 +0200\n> >> Carlos Martín Nieto <cmn@elego.de> wrote:\n> >>\n> >> > On Thu, 2011-07-14 at 16:18 +0530, J. Bakshi wrote:\n> >> > > On Thu, 14 Jul 2011 12:38:59 +0200\n> >> > > Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:\n> >> > >\n> >> > > > On Thu, Jul 14, 2011 at 12:36, J. Bakshi <joydeep@infoservices.in>\n> >> > > wrote:\n> >> > > >\n> >> > > > > How can I force git to use the username as define\n> >> > > at /home/git/PASSWD as the author name for git commit ?\n> >> > > >\n> >> > > > Edit the global bashrc to have:\n> >> > > >\n> >> > > >     export GIT_AUTHOR_NAME=$(cat ~/PASSWD)\n> >> > > >\n> >> > > > ?\n> >> > >\n> >> > > Thanks.\n> >> > >\n> >> > > [1] will it work with file generated by htpasswd ? as that file is\n> >> > > actually created by same (/home/git/PASSWD)\n> >> >\n> >> > Not directly, if it only has one line, then $(cat ~/PASSWD | cut -d ':'\n> >> > -f 1) should work, but I haven't tested it.\n> >> >\n> >> > >\n> >> > > [2] And the commit is over http, So is it effective to set the value\n> >> > > by .bashrc ?\n> >> >\n> >> > You are misunderstanding either how git works or the nomenclature. The\n> >> > commits all happen locally and need no authentication whatsoever (and\n> >> > usually you're expected to use a real name and email address). When you\n> >> > need to authenticate is when yuou push your changes somewhere (a central\n> >> > repo, for example). This is where the ~/.netrc file comes into play, as\n> >> > I mentioned in the reply to your other mail.\n> >> >\n> >> Exactly, when we need to push we are asked about authentication. I\n> >> like to configure the central git server in a way so that the\n> >> user-name as in authentication, be set as author name by the git\n> >> server itself. actually it is how I configured svn server over http.\n> >> So comparing to that I am trying to achieve the same. Say your\n> >> user-name is there at htpasswd file as Carlos, so when you\n> >> authenticate by Carlos to push , the author-name will automatically\n> >> become as Carlos. No way to customize that with specific username.\n> >> That's the idea.\n> >\n> > That's not how it works. It may even be possible to rewrite the commits\n> > in the post-receive hook in a way that most stuff doesn't break\n> > horribly, this would be rewriting history behind the users' backs, and\n> > that only brings problems.\n> \n> This will (as you point out) only lead to problems, because rewriting\n> the history at commit-time will have the effect that a push leaves you\n> in the situation where you end up with a different history on the\n> workstation and the server. All branches off the pushed branch will\n> become a hell, and a clusterfck of darkness and terror will take over.\n> \n> > The way to set the author name and mail in a standard way, be it\n> > user-wide or per-repo. You can write up some simple instructions on how\n> > to do it.\n> >\n> >    git config user.name \"Max Smith\"\n> >    git config user.mail max.smith@example.com\n> >\n> > and if the config should be valid for every repo, use --global flag.\n> > There is more information in the manual page.\n> >\n> > You could then add a check in the post-receive hook to reject pushes\n> > with invalid author names, if you feel it's worth it.\n> >\n> \n> Denying a push is much more elegant than rewriting, but (as I pointed\n> out in my other mail) also has a lot of problems with distributed\n> work-flows. And let's face it when changing from SVN to Git, the\n> distributed nature is about the last feature that you'd want to give\n> up ;)\n> \n> > Taking a step back, why is this even an issue, though? If you don't\n> > trust your developers to set their name and email correctly, why do you\n> > trust them to write code? If it's company policy for people to be\n> > referred to by their usernames rather than their given names, why not\n> > tell them to set it to that[0]? It seems like you are trying to solve a\n> > social issue with a technological measure that works at a different\n> > level.\n> \n> Very well said, I completely agree!\n\nAs I mentioned already in my previous mail, it is not an issue but we presently use it with svn in a positive way.\nSay 5 designer are working with same template, but in different section. So it is very easy to understand who is working on what\nand also these 5 designers can see/review the codes among them and how previous code effect their work. So this features are exploited here with that positive\ndirection. \n"},{"id":"171330","messageId":"1310646365.6041.46.camel@centaur.lab.cmartin.tk","threadId":"27812","inReplyTo":"20110714174916.07dd314d@shiva.selfip.org","subject":"Re: How to force git to use authentication as author","fromName":"Carlos Martín Nieto","fromEmail":"cmn@elego.de","sentAt":"2011-07-14T12:26:05Z","receivedAt":"2011-07-14T12:26:05Z","isPatch":false,"sender":{"key":"cmn@elego.de","avatar":"https://avatars.githubusercontent.com/u/335443?v=4"},"body":"On Thu, 2011-07-14 at 17:49 +0530, J. Bakshi wrote:\n> On Thu, 14 Jul 2011 14:00:06 +0200\n> Erik Faye-Lund <kusmabite@gmail.com> wrote:\n> \n> > On Thu, Jul 14, 2011 at 1:38 PM, Carlos Martín Nieto <cmn@elego.de> wrote:\n> > > On Thu, 2011-07-14 at 16:45 +0530, J. Bakshi wrote:\n> > >> On Thu, 14 Jul 2011 13:00:02 +0200\n> > >> Carlos Martín Nieto <cmn@elego.de> wrote:\n> > >>\n> > >> > On Thu, 2011-07-14 at 16:18 +0530, J. Bakshi wrote:\n> > >> > > On Thu, 14 Jul 2011 12:38:59 +0200\n> > >> > > Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:\n> > >> > >\n> > >> > > > On Thu, Jul 14, 2011 at 12:36, J. Bakshi <joydeep@infoservices.in>\n> > >> > > wrote:\n> > >> > > >\n> > >> > > > > How can I force git to use the username as define\n> > >> > > at /home/git/PASSWD as the author name for git commit ?\n> > >> > > >\n> > >> > > > Edit the global bashrc to have:\n> > >> > > >\n> > >> > > >     export GIT_AUTHOR_NAME=$(cat ~/PASSWD)\n> > >> > > >\n> > >> > > > ?\n> > >> > >\n> > >> > > Thanks.\n> > >> > >\n> > >> > > [1] will it work with file generated by htpasswd ? as that file is\n> > >> > > actually created by same (/home/git/PASSWD)\n> > >> >\n> > >> > Not directly, if it only has one line, then $(cat ~/PASSWD | cut -d ':'\n> > >> > -f 1) should work, but I haven't tested it.\n> > >> >\n> > >> > >\n> > >> > > [2] And the commit is over http, So is it effective to set the value\n> > >> > > by .bashrc ?\n> > >> >\n> > >> > You are misunderstanding either how git works or the nomenclature. The\n> > >> > commits all happen locally and need no authentication whatsoever (and\n> > >> > usually you're expected to use a real name and email address). When you\n> > >> > need to authenticate is when yuou push your changes somewhere (a central\n> > >> > repo, for example). This is where the ~/.netrc file comes into play, as\n> > >> > I mentioned in the reply to your other mail.\n> > >> >\n> > >> Exactly, when we need to push we are asked about authentication. I\n> > >> like to configure the central git server in a way so that the\n> > >> user-name as in authentication, be set as author name by the git\n> > >> server itself. actually it is how I configured svn server over http.\n> > >> So comparing to that I am trying to achieve the same. Say your\n> > >> user-name is there at htpasswd file as Carlos, so when you\n> > >> authenticate by Carlos to push , the author-name will automatically\n> > >> become as Carlos. No way to customize that with specific username.\n> > >> That's the idea.\n> > >\n> > > That's not how it works. It may even be possible to rewrite the commits\n> > > in the post-receive hook in a way that most stuff doesn't break\n> > > horribly, this would be rewriting history behind the users' backs, and\n> > > that only brings problems.\n> > \n> > This will (as you point out) only lead to problems, because rewriting\n> > the history at commit-time will have the effect that a push leaves you\n> > in the situation where you end up with a different history on the\n> > workstation and the server. All branches off the pushed branch will\n> > become a hell, and a clusterfck of darkness and terror will take over.\n> > \n> > > The way to set the author name and mail in a standard way, be it\n> > > user-wide or per-repo. You can write up some simple instructions on how\n> > > to do it.\n> > >\n> > >    git config user.name \"Max Smith\"\n> > >    git config user.mail max.smith@example.com\n> > >\n> > > and if the config should be valid for every repo, use --global flag.\n> > > There is more information in the manual page.\n> > >\n> > > You could then add a check in the post-receive hook to reject pushes\n> > > with invalid author names, if you feel it's worth it.\n> > >\n> > \n> > Denying a push is much more elegant than rewriting, but (as I pointed\n> > out in my other mail) also has a lot of problems with distributed\n> > work-flows. And let's face it when changing from SVN to Git, the\n> > distributed nature is about the last feature that you'd want to give\n> > up ;)\n> > \n> > > Taking a step back, why is this even an issue, though? If you don't\n> > > trust your developers to set their name and email correctly, why do you\n> > > trust them to write code? If it's company policy for people to be\n> > > referred to by their usernames rather than their given names, why not\n> > > tell them to set it to that[0]? It seems like you are trying to solve a\n> > > social issue with a technological measure that works at a different\n> > > level.\n> > \n> > Very well said, I completely agree!\n> \n> As I mentioned already in my previous mail, it is not an issue but we\n> presently use it with svn in a positive way.\n> Say 5 designer are working with same template, but in different\n> section. So it is very easy to understand who is working on what\n> and also these 5 designers can see/review the codes among them and how\n> previous code effect their work. So this features are exploited here\n> with that positive\n> direction. \n> \n\nI don't see how using people's real name is any less clear about who\nthey are. Alternatively, you can use their email addresses to tell them\napart.\n\nWith git, you can fetch the changes from either a central repository or\na particular developer's/designer's repo and see what they are changing\nwithout affecting your local copy. Say you fetch from developer B's repo\nand you want to see what the differences are, you just do\n\n    git diff B/some-branch\n\nor if you want to see if the changes would merge cleanly, you create a\n(local) branch and try to merge there. Or you can do it on your dev\nbranch and roll-back if it doesn't work.\n\nHow does your current workflow depend on usernames? From what you\ndescribe, the above would work just as well.\n\nCheers,\n   cmn\n"},{"id":"171333","messageId":"m3zkkh9gmq.fsf@localhost.localdomain","threadId":"27812","inReplyTo":"1310643482.6041.17.camel@centaur.lab.cmartin.tk","subject":"Re: How to force git to use authentication as author","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2011-07-14T12:44:50Z","receivedAt":"2011-07-14T12:44:50Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Carlos Martín Nieto <cmn@elego.de> writes:\n\n> That's not how it works. It may even be possible to rewrite the commits\n> in the post-receive hook in a way that most stuff doesn't break\n> horribly, this would be rewriting history behind the users' backs, and\n> that only brings problems.\n\nWhat you can do is forbid push.  I think update-paranoid and gitolite\nhave some examples on how to do that.\n \n> The way to set the author name and mail in a standard way, be it\n> user-wide or per-repo. You can write up some simple instructions on how\n> to do it.\n> \n>     git config user.name \"Max Smith\"\n>     git config user.mail max.smith@example.com\n> \n> and if the config should be valid for every repo, use --global flag.\n> There is more information in the manual page.\n> \n> You could then add a check in the post-receive hook to reject pushes\n> with invalid author names, if you feel it's worth it.\n> \n> Taking a step back, why is this even an issue, though? If you don't\n> trust your developers to set their name and email correctly, why do you\n> trust them to write code? If it's company policy for people to be\n> referred to by their usernames rather than their given names, why not\n> tell them to set it to that[0]? It seems like you are trying to solve a\n> social issue with a technological measure that works at a different\n> level.\n> \n> [0] and given that they're probably using their company email address,\n> it wouldn't be a problem to get a unique ID for each developer if that's\n> what you need.\n\nNote that there is also .mailmap mechanism (see the documentation)\nwhich can translate on the fly between public emails and internal\ncompany emails, and which can fix invalid names... at least got\ngit-log, git-blame etc.\n\n-- \nJakub Narębski\n"},{"id":"171371","messageId":"20110714194552.GA14632@elie","threadId":"27812","inReplyTo":"CABPQNSY3qyQXO4hyM6xhHq2VYhK5369ihuqJ5PDAonN7+UpcGA@mail.gmail.com","subject":"Re: How to force git to use authentication as author","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-07-14T19:45:52Z","receivedAt":"2011-07-14T19:45:52Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nErik Faye-Lund wrote:\n\n> So let's step back a little bit. Why do you want the author to be\n> identical to the authenticated user in the first place? Is it to be\n> able to *prove* (i.e not trust the users that push) who wrote what\n> code? If so, let's me first tell you that giving someone push-access\n> while not trusting them is a bit crazy. But if you're happy with being\n> a bit crazy, you'd might want to somehow cryptographically sign the\n> commits instead. I'd go for PGP-signing the patch-id, and putting that\n> in a git-note.\n\nLet's suppose you want to be able to decide who was to blame for the\nlatest breakage, not on a per-commit level but on a per-push level.\nThen that seems quite doable to me through simpler means, on the\nserver side.  See\n\n http://sitaramc.github.com/gitolite/doc/3-faq-tips-etc.html#_better_logging\n\nHope that helps.\nJonathan\n"}]}