git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Post-update hook problems

From
GFGeoffrey 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
Next: Frank Lichtenheld
Message 1 of 3 in “Post-update hook problems”
  1. Geoffrey FerrariOct 5, 2007
  2. Frank LichtenheldOct 5, 2007
  3. Mike RalphsonOct 5, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.