I need to set up post-receive hook script on Gitblit server that will pull changes to a website on the same server. In a bash script, command would look something like this:
sudo git --work-tree=/var/www/html/mysite --git-dir=/var/www/html/mysite/.git pull
But as I understand, Gitblit uses groovy hooks scripts, and I'm completely new to this. Can someone please help me with creating a groovy script for this, or at least direct me to some good examples or tutorial for Groovy.
Thanks
In case someone needs help with groovy, here is my groovy script:
import org.slf4j.Logger
def res = ["git", "--work-tree=/var/www/html/mysite", "--git-dir=/var/www/html/mysite/.git", "pull"].execute()
println res.err.text
println res.text