diff --git a/continuousintegration/buildtree_runner/vmBootstrap/bootstrapCTA.sh b/continuousintegration/buildtree_runner/vmBootstrap/bootstrapCTA.sh
index 122df0448681cf1ac02ca47517df9be54192c53f..60444000ac28b9a091592631a15fffb0d061b423 100755
--- a/continuousintegration/buildtree_runner/vmBootstrap/bootstrapCTA.sh
+++ b/continuousintegration/buildtree_runner/vmBootstrap/bootstrapCTA.sh
@@ -4,6 +4,14 @@ set -x
 
 echo Getting CTA sources...
 ( cd ~ ; git clone https://:@gitlab.cern.ch:8443/cta/CTA.git; cd CTA ; git submodule update --init --recursive)
+cat > ~/CTA/.git/hooks/post-checkout << EOFGitHook
+#!/bin/sh
+cd `git rev-parse --show-toplevel`
+git submodule update --init --recursive
+EOFGitHook
+
+chmod +x ~/CTA/.git/hooks/post-checkout
+cp ~/CTA/.git/hooks/post-checkout ~/CTA/.git/hooks/post-merge
 
 echo Creating source rpm
 mkdir -p ~/CTA-build-srpm