From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ferry Huberts Subject: Re: How to force git to use authentication as author Date: Thu, 14 Jul 2011 14:16:25 +0200 Message-ID: <4E1EDE19.6060109@hupie.com> References: <20110714160638.065b6542@shiva.selfip.org> <20110714161838.1e30893a@shiva.selfip.org> <1310641202.18730.16.camel@bee.lab.cmartin.tk> <20110714164547.0b359e60@shiva.selfip.org> <1310643482.6041.17.camel@centaur.lab.cmartin.tk> <20110714173129.1116e4b2@shiva.selfip.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: =?UTF-8?B?Q2FybG9zIE1hcnTDrW4gTmlldG8=?= , =?UTF-8?B?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= , git@vger.kernel.org To: "J. Bakshi" X-From: git-owner@vger.kernel.org Thu Jul 14 14:36:21 2011 Return-path: Envelope-to: gcvg-git-2@lo.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QhL9P-0002rU-Sy for gcvg-git-2@lo.gmane.org; Thu, 14 Jul 2011 14:36:20 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754717Ab1GNMgH convert rfc822-to-quoted-printable (ORCPT ); Thu, 14 Jul 2011 08:36:07 -0400 Received: from 82-197-206-98.dsl.cambrium.nl ([82.197.206.98]:57312 "EHLO mail.hupie.dyndns.org" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754605Ab1GNMgF convert rfc822-to-8bit (ORCPT ); Thu, 14 Jul 2011 08:36:05 -0400 X-Greylist: delayed 1177 seconds by postgrey-1.27 at vger.kernel.org; Thu, 14 Jul 2011 08:36:04 EDT Received: from stinkpad.internal.hupie.com (unknown [188.205.88.52]) by mail.hupie.dyndns.org (Postfix) with ESMTP id BA0FF21E692; Thu, 14 Jul 2011 14:16:25 +0200 (CEST) User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc15 Thunderbird/3.1.10 In-Reply-To: <20110714173129.1116e4b2@shiva.selfip.org> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: On 07/14/2011 02:01 PM, J. Bakshi wrote: > On Thu, 14 Jul 2011 13:38:02 +0200 > Carlos Mart=C3=ADn Nieto wrote: >=20 >> On Thu, 2011-07-14 at 16:45 +0530, J. Bakshi wrote: >>> On Thu, 14 Jul 2011 13:00:02 +0200 >>> Carlos Mart=C3=ADn Nieto wrote: >>> >>>> On Thu, 2011-07-14 at 16:18 +0530, J. Bakshi wrote: >>>>> On Thu, 14 Jul 2011 12:38:59 +0200 >>>>> =C3=86var Arnfj=C3=B6r=C3=B0 Bjarmason wrote: >>>>> >>>>>> On Thu, Jul 14, 2011 at 12:36, J. Bakshi >>>>> wrote: >>>>>> >>>>>>> How can I force git to use the username as define >>>>> at /home/git/PASSWD as the author name for git commit ? >>>>>> >>>>>> Edit the global bashrc to have: >>>>>> >>>>>> export GIT_AUTHOR_NAME=3D$(cat ~/PASSWD) >>>>>> >>>>>> ? >>>>> >>>>> Thanks.=20 >>>>> >>>>> [1] will it work with file generated by htpasswd ? as that file i= s >>>>> actually created by same (/home/git/PASSWD) >>>> >>>> Not directly, if it only has one line, then $(cat ~/PASSWD | cut -= d ':' >>>> -f 1) should work, but I haven't tested it. >>>> >>>>> >>>>> [2] And the commit is over http, So is it effective to set the va= lue >>>>> by .bashrc ? >>>> >>>> You are misunderstanding either how git works or the nomenclature.= The >>>> commits all happen locally and need no authentication whatsoever (= and >>>> usually you're expected to use a real name and email address). Whe= n you >>>> need to authenticate is when yuou push your changes somewhere (a c= entral >>>> repo, for example). This is where the ~/.netrc file comes into pla= y, as >>>> I mentioned in the reply to your other mail. >>>> >>> 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= =2E >>> 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. >> >> That's not how it works. It may even be possible to rewrite the comm= its >> in the post-receive hook in a way that most stuff doesn't break >> horribly, this would be rewriting history behind the users' backs, a= nd >> that only brings problems. >> >> The way to set the author name and mail in a standard way, be it >> user-wide or per-repo. You can write up some simple instructions on = how >> to do it. >> >> git config user.name "Max Smith" >> git config user.mail max.smith@example.com >> >> and if the config should be valid for every repo, use --global flag. >> There is more information in the manual page. >> >> You could then add a check in the post-receive hook to reject pushes >> with invalid author names, if you feel it's worth it. >> >> Taking a step back, why is this even an issue, though? If you don't >> trust your developers to set their name and email correctly, why do = you >> trust them to write code? If it's company policy for people to be >> referred to by their usernames rather than their given names, why no= t >> tell them to set it to that[0]? It seems like you are trying to solv= e a >> social issue with a technological measure that works at a different >> level. >> >=20 > Certainly not an issue at all. As I have mentioned before it is how t= he svn repo is working here.=20 > So we are trying to follow the same with git too. Without effecting t= oo much of the already running > environment, so that the users need not bother too much with git. But= as I have found it is not possible right now >=20 As Erik said: > This will (as you point out) only lead to problems, because rewriting > the history at commit-time will have the effect that a push leaves yo= u > in the situation where you end up with a different history on the > workstation and the server. All branches off the pushed branch will > become a hell, and a clusterfck of darkness and terror will take over= =2E SVN and Git are _totally_ different models. Do not try to force Git int= o the svn model, it'll just give you __major__ headaches. OTOH: It'll teach your users all the advanced uses of Git very rapidly.= LOL > http://permalink.gmane.org/gmane.comp.version-control.git/171444 > -- > To unsubscribe from this list: send the line "unsubscribe git" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html --=20 =46erry Huberts