I am trying to add a post-commit hook to a bare repository, such that whenever a commit is made the changed files are automatically installed in a (hardcoded) directory.
Is there a way to fetch a single file from the repository?
git-clone does not appear to allow for specifying a path, and any other commands that I found (git-fetch, git-pull) seem to require an existing local git repository to work.
Is there a way to do this?
You may find the answers in: How to do a "git export"
In particular, git checkout-index
will probably do the job for you:
git checkout-index -a -f --prefix=/destination/path/
Don't forget the trailing slash or this command won't do exactly what you want.