I have a script on the client machine that adds the necessary configuration stuff to gitosis.conf on the server. I'm able to push and everything works correctly.
However, I want to add a post-receive hook so that when the repository is first pushed, some particular action occurs. I tried to add it to the local repository before the first version (in .git/hooks) but the hook wasn't transferred to the server on a push.
How can I do this? There is no repository in the /srv/gitosis/repositories directory until the initial push.
-
Hooks are not pushed to server via
git push
. Otherwise, this would arise a severe security issue: anyone can push code that is executed on your server with higher privileges.To workaround the issue, you may just copy the hook into the created directory, and run it manually after your first push:
GIT_DIR=. hooks/post-receive
You'll have to do this only once.
dave paola : I'm trying to do this programatically though. These repositories are created by a script.Pavel Shved : @davezor, well, the most obiovus way then would be to fix gitosis itself, so it stores per-repository hooks inside gitosis repository, and saves them to the proper folders. I think such functionality (unless it's already implemented) would be useful to community as well.From Pavel Shved -
Git uses templates to set up new repositories. I don't know if Gitorious uses these same templates, but it's worth checking out. On my system they exist at
/usr/local/share/git-core/templates/hooks
.dave paola : I checked out the gitosis documentation and it's extremely sparse. Is there a way to add a template conditionally?From Kevin Ballard
0 comments:
Post a Comment