git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Post-update hook problems
@ 2007-10-05 11:27 Geoffrey Ferrari
  2007-10-05 12:08 ` Frank Lichtenheld
  0 siblings, 1 reply; 3+ messages in thread
From: Geoffrey Ferrari @ 2007-10-05 11:27 UTC (permalink / raw)
  To: git

I have a public and a private git repository on the same machine, in
the same user's home directory. I want to ensure that when the public
repos is updated, the private repos automatically receives those
updates. Let's just assume that this is a good idea.

So, I've created a post-update hook script and made it executable. The
script is very simple. It 'cd's to the private repos and then does a
git pull. It looks, in essence, like this:

--
#!/bin/sh

cd /user/home/private/repos
git pull

exit 0
--

When I run this script directly, it works fine. (It also works fine
when I run it directly over ssh). However, when I do a git push to the
public repos, (either locally or remotely over ssh) the script is
called but reports back the following error:

--
fatal: Not a git repository: '.'
Failed to find a valid git directory.
--

Can anyone explain why this happens? And how can I make the script
work properly?

With sincere thanks for your help,

Geoffrey Ferrari

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

* Re: Post-update hook problems
  2007-10-05 11:27 Post-update hook problems Geoffrey Ferrari
@ 2007-10-05 12:08 ` Frank Lichtenheld
  2007-10-05 12:27   ` Mike Ralphson
  0 siblings, 1 reply; 3+ messages in thread
From: Frank Lichtenheld @ 2007-10-05 12:08 UTC (permalink / raw)
  To: Geoffrey Ferrari; +Cc: git

On Fri, Oct 05, 2007 at 12:27:22PM +0100, Geoffrey Ferrari wrote:
> --
> fatal: Not a git repository: '.'
> Failed to find a valid git directory.
> --
> 
> Can anyone explain why this happens? And how can I make the script
> work properly?

I'm no hook expert, but it may have something to do with some
environment variables that are set in hooks, you might need to change
variables like GIT_DIR.

Gruesse,
-- 
Frank Lichtenheld <frank@lichtenheld.de>
www: http://www.djpig.de/

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

* Re: Post-update hook problems
  2007-10-05 12:08 ` Frank Lichtenheld
@ 2007-10-05 12:27   ` Mike Ralphson
  0 siblings, 0 replies; 3+ messages in thread
From: Mike Ralphson @ 2007-10-05 12:27 UTC (permalink / raw)
  To: Frank Lichtenheld; +Cc: Geoffrey Ferrari, git

On 10/5/07, Frank Lichtenheld <frank@lichtenheld.de> wrote:
> On Fri, Oct 05, 2007 at 12:27:22PM +0100, Geoffrey Ferrari wrote:
> > --
> > fatal: Not a git repository: '.'
> > Failed to find a valid git directory.
> > --
> >
> > Can anyone explain why this happens? And how can I make the script
> > work properly?
>
> I'm no hook expert, but it may have something to do with some
> environment variables that are set in hooks, you might need to change
> variables like GIT_DIR.

Ack.

The hooks seem to assume repositories pushed into are bare, so the
GIT_DIR isn't set to a .git subdirectory (even if it exists).

Mike

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

end of thread, other threads:[~2007-10-05 12:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-05 11:27 Post-update hook problems Geoffrey Ferrari
2007-10-05 12:08 ` Frank Lichtenheld
2007-10-05 12:27   ` Mike Ralphson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).