From mboxrd@z Thu Jan 1 00:00:00 1970 From: "J. Bakshi" Subject: Re: git pre-push hook to restrict master branch push !!! Date: Wed, 20 Jun 2012 18:09:47 +0530 Message-ID: <20120620180947.755a96ba@shiva.selfip.org> References: <20120611164851.0e4db9f0@shiva.selfip.org> <20120611174757.2f0bdd83@shiva.selfip.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Sitaram Chamarty , git@vger.kernel.org To: unlisted-recipients:; (no To-header on input) X-From: git-owner@vger.kernel.org Wed Jun 20 14:51:01 2012 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ShKN5-0002O8-VD for gcvg-git-2@plane.gmane.org; Wed, 20 Jun 2012 14:50:56 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754023Ab2FTMuw (ORCPT ); Wed, 20 Jun 2012 08:50:52 -0400 Received: from static.88-198-19-49.clients.your-server.de ([88.198.19.49]:49000 "EHLO zimbra.infoservices.in" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753584Ab2FTMub (ORCPT ); Wed, 20 Jun 2012 08:50:31 -0400 X-Greylist: delayed 635 seconds by postgrey-1.27 at vger.kernel.org; Wed, 20 Jun 2012 08:50:31 EDT Received: from localhost (localhost [127.0.0.1]) by zimbra.infoservices.in (Postfix) with ESMTP id 3436BDE31F3; Wed, 20 Jun 2012 14:39:54 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.infoservices.in Received: from zimbra.infoservices.in ([127.0.0.1]) by localhost (zimbra.infoservices.in [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oC1z8waQKvZy; Wed, 20 Jun 2012 14:39:53 +0200 (CEST) Received: from shiva.selfip.org (unknown [122.176.30.116]) by zimbra.infoservices.in (Postfix) with ESMTPSA id CEA8FDE31E6; Wed, 20 Jun 2012 14:39:51 +0200 (CEST) In-Reply-To: <20120611174757.2f0bdd83@shiva.selfip.org> X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: On Mon, 11 Jun 2012 17:47:57 +0530 "J. Bakshi" wrote: > On Mon, 11 Jun 2012 17:40:37 +0530 > Sitaram Chamarty wrote: > > > On Mon, Jun 11, 2012 at 4:48 PM, J. Bakshi > > wrote: > > > Hello list, > > > > > > I have a central server where git repos are located and based on http base push/pull. > > > authentication is done by a text based password file, generated by htpasswd. > > > > > > I am searching for a server side hook (pre-push) which can prevent all push to master, > > > except few users found at that password file generated by htpasswd. Is there any such hook > > > available ? Some suggest to use gitolite, but it also based on the hooks to do the same. > > > > If you don't want to use gitolite, you can roll your own update hook. > > It can be as simple as > > > > - check $REMOTE_USER to see if the name is in the "allowed" list > > (your choice how you want to maintain that list). If allowed, 'exit > > 0". > > - otherwise check $1 (argument 1) to see if it is > > "refs/heads/master". If it is, "exit 1". > > > > How difficult is that? > > Thanks for the clue. I'm not familiar with the hook programming. > I'll check further with the clues you have given. > > -- with regards. > -- The refs/heads/master checking is fine. Can I placed this checking in my httpd.conf file to check user against a htpasswd file ? Thanks