Skip to content

Instantly share code, notes, and snippets.

@xdissent
Created June 20, 2011 21:41
Show Gist options
  • Save xdissent/1036653 to your computer and use it in GitHub Desktop.
Save xdissent/1036653 to your computer and use it in GitHub Desktop.
Git post-receive hook to update Redmine changesets
#!/bin/sh
# Add this hook to /usr/share/git-core/templates/hooks to enable for all new repositories.
REPO_URL=`echo $PWD | sed 's:/hooks$::'` /usr/share/redmine/script/runner /usr/share/redmine/extra/update_repository.rb -e production > /dev/null 2>&1 &
# Add this code to /usr/share/redmine/extra/update_repository.rb
r = Repository.find_by_url(ENV['REPO_URL'])
r.fetch_changesets unless r.nil?
@xdissent
Copy link
Author

Your gitosis user should belong to the www-data group (or whichever group your web server runs as) so it may update the repository in your database if using Sqlite:
$ usermod -a -G www-data gitosis

@xdissent
Copy link
Author

Oh, and now you can turn "Auto-fetch Commits" off in Redmine's settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment