All of lore.kernel.org
 help / color / mirror / Atom feed
* git pre-push hook to restrict master branch push !!!
@ 2012-06-11 11:18 J. Bakshi
  2012-06-11 12:10 ` Sitaram Chamarty
  0 siblings, 1 reply; 4+ messages in thread
From: J. Bakshi @ 2012-06-11 11:18 UTC (permalink / raw)
  To: git

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.

Thanks

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: git pre-push hook to restrict master branch push !!!
  2012-06-11 11:18 git pre-push hook to restrict master branch push !!! J. Bakshi
@ 2012-06-11 12:10 ` Sitaram Chamarty
  2012-06-11 12:17   ` J. Bakshi
  0 siblings, 1 reply; 4+ messages in thread
From: Sitaram Chamarty @ 2012-06-11 12:10 UTC (permalink / raw)
  To: J. Bakshi; +Cc: git

On Mon, Jun 11, 2012 at 4:48 PM, J. Bakshi
<joydeep.bakshi@infoservices.in> 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?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: git pre-push hook to restrict master branch push !!!
  2012-06-11 12:10 ` Sitaram Chamarty
@ 2012-06-11 12:17   ` J. Bakshi
  2012-06-20 12:39     ` J. Bakshi
  0 siblings, 1 reply; 4+ messages in thread
From: J. Bakshi @ 2012-06-11 12:17 UTC (permalink / raw)
  To: Sitaram Chamarty; +Cc: git

On Mon, 11 Jun 2012 17:40:37 +0530
Sitaram Chamarty <sitaramc@gmail.com> wrote:

> On Mon, Jun 11, 2012 at 4:48 PM, J. Bakshi
> <joydeep.bakshi@infoservices.in> 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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: git pre-push hook to restrict master branch push !!!
  2012-06-11 12:17   ` J. Bakshi
@ 2012-06-20 12:39     ` J. Bakshi
  0 siblings, 0 replies; 4+ messages in thread
From: J. Bakshi @ 2012-06-20 12:39 UTC (permalink / raw)
  Cc: Sitaram Chamarty, git

On Mon, 11 Jun 2012 17:47:57 +0530
"J. Bakshi" <joydeep.bakshi@infoservices.in> wrote:

> On Mon, 11 Jun 2012 17:40:37 +0530
> Sitaram Chamarty <sitaramc@gmail.com> wrote:
> 
> > On Mon, Jun 11, 2012 at 4:48 PM, J. Bakshi
> > <joydeep.bakshi@infoservices.in> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-06-20 12:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-11 11:18 git pre-push hook to restrict master branch push !!! J. Bakshi
2012-06-11 12:10 ` Sitaram Chamarty
2012-06-11 12:17   ` J. Bakshi
2012-06-20 12:39     ` J. Bakshi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.