private void gitCloneForPull(final GitRepoDoc gitRepoDoc, final Path gitWorkDir)
            throws IOException {
        LOGGER.info("Cloning repository '{}' to '{}' for pull", gitRepoDoc.getUrl(), gitWorkDir);

        // Delete everything under gitWork (including all git stuff)
        this.ensureDirectoryExists(gitWorkDir);
        this.deleteFileTree(gitWorkDir, false);

        try (Git git = Git.cloneRepository()
                .setURI(gitRepoDoc.getUrl())
                .setDirectory(gitWorkDir.toFile())
                .setCredentialsProvider(this.getGitCreds(gitRepoDoc))
                .setDepth(1)
                .setBranch(gitRepoDoc.getBranch())
                .setCloneAllBranches(false)
                .call()) {

            // No code - close automatically
        } catch (GitAPIException e) {
            throw new IOException("Git error cloning repository "
                                  + gitRepoDoc.getUrl(), e);
        }
    }
Clones the GIT repository represented by gitRepoDoc
into the local gitWorkDir.

@param gitRepoDoc Holds the settings of the Git Repo.
@param gitWorkDir Where to put the Git repo files.
@throws IOException If something goes wrong.
stroom-gitrepo/stroom-gitrepo-impl/src/main/java/stroom/gitrepo/impl/GitRepoStorageService.java