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: Mon, 11 Jun 2012 17:47:57 +0530 Message-ID: <20120611174757.2f0bdd83@shiva.selfip.org> References: <20120611164851.0e4db9f0@shiva.selfip.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: git@vger.kernel.org To: Sitaram Chamarty X-From: git-owner@vger.kernel.org Mon Jun 11 14:18:15 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 1Se3ZU-00024p-2A for gcvg-git-2@plane.gmane.org; Mon, 11 Jun 2012 14:18:12 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754315Ab2FKMSH (ORCPT ); Mon, 11 Jun 2012 08:18:07 -0400 Received: from static.88-198-19-49.clients.your-server.de ([88.198.19.49]:52579 "EHLO zimbra.infoservices.in" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754190Ab2FKMSG (ORCPT ); Mon, 11 Jun 2012 08:18:06 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.infoservices.in (Postfix) with ESMTP id AB0E6DE05A1; Mon, 11 Jun 2012 14:18:04 +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 cb-eErzTVy4w; Mon, 11 Jun 2012 14:18:03 +0200 (CEST) Received: from shiva.selfip.org (unknown [122.176.30.116]) by zimbra.infoservices.in (Postfix) with ESMTPSA id 98C47DE0444; Mon, 11 Jun 2012 14:18:02 +0200 (CEST) In-Reply-To: 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: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.