@Override protected Iterable<PushResult> doPush(Git git) throws Exception { return this.git.push().setCredentialsProvider(getCredentials()).setRemote(getRemote()).call(); }
protected void doPull() { CredentialsProvider cp = getCredentials(); try { Repository repository = git.getRepository(); StoredConfig config = repository.getConfig(); String url = config.getString("remote", "origin", "url"); if (Strings.isBlank(url)) { logPull("No remote repository defined for the git repository at " + getRootGitDirectory().getCanonicalPath() + " so not doing a pull"); return; } String branch = repository.getBranch(); String mergeUrl = config.getString("branch", branch, "merge"); if (Strings.isBlank(mergeUrl)) { logPull("No merge spec for branch." + branch + ".merge in the git repository at " + getRootGitDirectory().getCanonicalPath() + " so not doing a pull"); return; } logPull("Performing a pull in git repository " + getRootGitDirectory().getCanonicalPath() + " on remote URL: " + url); git.pull().setCredentialsProvider(cp).setRebase(true).call(); } catch (Throwable e) { String credText = ""; if (cp instanceof UsernamePasswordCredentialsProvider) { } LOG.error("Failed to pull from the remote git repo with credentials " + cp + " due: " + e.getMessage() + ". This exception is ignored.", e); } finally { firstPull = false; } }
boolean cloneAll = isCloneAllBranches(); LOG.info("Cloning git repo " + repo + " into directory " + confDir.getCanonicalPath() + " cloneAllBranches: " + cloneAll); CloneCommand command = Git.cloneRepository().setCredentialsProvider(getCredentials()). setCloneAllBranches(cloneAll).setURI(repo).setDirectory(confDir).setRemote(remote); try {