Post-update hook problems
- From
- Geoffrey Ferrari <geoffrey.ferrari@googlemail.com>
- Date
- Oct 5, 2007, 11:27 UTC
- Message-ID
- <930d91430710050427o79395023nffe3bd842a87cddb@mail.gmail.com>
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