Need a groovy push hook scripts from your Gitblit instance to another Gitblit instance
I have two private linux servers
, Say A
and B
with GitBlit
install on both. All developers do commit and push their changes on server A
, I want B
keep in sync with A
.
There is some Groovy hook
but I am totally new in this, Can any one help to provide it.
PS: If There any push event found on A
some script will fire and it push
changes to B
Thanks james-moger
.
Base on my answer below are the snap of script.
File baseFolder = new File("/root/softwares/apache-tomcat-6.0.32/webapps/gitblit/WEB-INF/data/git");
File repoFolder = new File(baseFolder, repository.name);
Git git = Git.open(repoFolder, FS.detect())
git.push().setRemote("ssh://admin@111.11.111.111:29418/testrepo.git").setPushAll().call();