org.eclipse.jgit.api.errors.TransportException Java Examples

The following examples show how to use org.eclipse.jgit.api.errors.TransportException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WorkerTest.java    From github-bucket with ISC License 6 votes vote down vote up
@Test
public void shouldFailOnException() throws Exception {
    // Given
    SyncableRepository pushRepository = config.getPushRepository();
    Git git = mock(Git.class);
    doNothing().when(git).close();

    CloneCommand cloneCommand = mock(CloneCommand.class);
    when(cloneCommand.setBare(true)).thenReturn(cloneCommand);
    when(cloneCommand.call()).thenThrow(new TransportException("Expected test exception"));
    when(pushRepository.clone(any())).thenReturn(cloneCommand);
    when(config.configure(cloneCommand)).thenReturn(cloneCommand);

    exception.expect(TransportException.class);
    exception.expectMessage("Expected test exception");

    // When
    Status status = uut.call();

    // Then
    assertThat(status, is(FAILED));
}
 
Example #2
Source File: GitAPIExceptionWrapper.java    From proctor with Apache License 2.0 6 votes vote down vote up
public StoreException.TestUpdateException wrapException(final StoreException.TestUpdateException exception) {
    final Throwable cause = exception.getCause();

    if (gitUrl.endsWith(".git")) {
        if (cause instanceof TransportException) {
            if (cause.getMessage().contains("not authorized")) {
                return new GitNoAuthorizationException("Please check your user name and password", exception);
            } else if (cause.getMessage().contains("git-receive-pack not permitted")) {
                return new GitNoDevelperAccessLevelException(
                        "Check if your access level is developer in [" + gitUrl.substring(0, gitUrl.length() - 4) + "/project_members]",
                        exception);
            } else if (cause.getMessage().matches("^50\\d\\s.*")) {
                return new GitServerErrorException("Check if " + gitUrl + " is available", exception);
            }
        } else if (cause instanceof IllegalStateException) {
            if ("pre-receive hook declined".equals(cause.getMessage())) {
                return new GitNoMasterAccessLevelException(
                        "Check if your access level is master in [" + gitUrl.substring(0, gitUrl.length() - 4) + "/project_members]",
                        exception);
            }
        }
    }
    return exception;
}
 
Example #3
Source File: JGitEnvironmentRepositoryTests.java    From spring-cloud-config with Apache License 2.0 6 votes vote down vote up
@Test
public void shouldDeleteBaseDirWhenCloneFails() throws Exception {
	Git mockGit = mock(Git.class);
	CloneCommand mockCloneCommand = mock(CloneCommand.class);

	when(mockCloneCommand.setURI(anyString())).thenReturn(mockCloneCommand);
	when(mockCloneCommand.setDirectory(any(File.class))).thenReturn(mockCloneCommand);
	when(mockCloneCommand.call())
			.thenThrow(new TransportException("failed to clone"));

	JGitEnvironmentRepository envRepository = new JGitEnvironmentRepository(
			this.environment, new JGitEnvironmentProperties());
	envRepository.setGitFactory(new MockGitFactory(mockGit, mockCloneCommand));
	envRepository.setUri("http://somegitserver/somegitrepo");
	envRepository.setBasedir(this.basedir);

	try {
		envRepository.findOne("bar", "staging", "master");
	}
	catch (Exception ex) {
		// expected - ignore
	}

	assertThat(this.basedir.listFiles().length > 0)
			.as("baseDir should be deleted when clone fails").isFalse();
}
 
Example #4
Source File: WorkerTest.java    From github-bucket with ISC License 6 votes vote down vote up
@Test
public void shouldFailOnException() throws Exception {
    // Given
    SyncableRepository pushRepository = config.getPushRepository();
    Git git = mock(Git.class);
    doNothing().when(git).close();

    CloneCommand cloneCommand = mock(CloneCommand.class);
    when(cloneCommand.setBare(true)).thenReturn(cloneCommand);
    when(cloneCommand.call()).thenThrow(new TransportException("Expected test exception"));
    when(pushRepository.clone(any())).thenReturn(cloneCommand);
    when(config.configure(cloneCommand)).thenReturn(cloneCommand);

    exception.expect(TransportException.class);
    exception.expectMessage("Expected test exception");

    // When
    Status status = uut.call();

    // Then
    assertThat(status, is(FAILED));
}
 
Example #5
Source File: GitUtil.java    From Jpom with MIT License 6 votes vote down vote up
/**
 * 获取仓库远程的所有分支
 *
 * @param url                 远程url
 * @param file                仓库clone到本地的文件夹
 * @param credentialsProvider 凭证
 * @return list
 * @throws GitAPIException api
 * @throws IOException     IO
 */
private static List<String> branchList(String url, File file, CredentialsProvider credentialsProvider) throws GitAPIException, IOException {
    try (Git git = initGit(url, file, credentialsProvider)) {
        //
        List<Ref> list = git.branchList().setListMode(ListBranchCommand.ListMode.REMOTE).call();
        List<String> all = new ArrayList<>(list.size());
        list.forEach(ref -> {
            String name = ref.getName();
            if (name.startsWith(Constants.R_REMOTES + Constants.DEFAULT_REMOTE_NAME)) {
                all.add(name.substring((Constants.R_REMOTES + Constants.DEFAULT_REMOTE_NAME).length() + 1));
            }
        });
        return all;
    } catch (TransportException t) {
        checkTransportException(t);
        throw t;
    }
}
 
Example #6
Source File: EmbeddedHttpGitServerTest.java    From smart-testing with Apache License 2.0 6 votes vote down vote up
@Test
public void should_fail_with_repository_not_found_when_trying_to_clone_non_existing_repo() throws Exception {
    // given
    gitServer = EmbeddedHttpGitServer.fromBundle("launchpad", "saas-launchpad.bundle")
        .usingPort(6432)
        .create();
    gitServer.start();

    expectedException.expect(TransportException.class);
    expectedException.expectMessage("Git repository not found");

    // when
    final GitCloner launchpadCloner = new GitCloner("http://localhost:6432/launchpadeeeee");
    final Repository launchpad = launchpadCloner.cloneRepositoryToTempFolder();

    // then
    // should fail
}
 
Example #7
Source File: JGitUtil.java    From mcg-helper with Apache License 2.0 6 votes vote down vote up
public static boolean cloneRepository(String remoteUrl, String branch, String projectPath, String user, String pwd) throws InvalidRemoteException, TransportException, GitAPIException {
   	File projectDir = new File(projectPath);

       UsernamePasswordCredentialsProvider provider = new UsernamePasswordCredentialsProvider(user, pwd);
       try (Git git = Git.cloneRepository()
               .setURI(remoteUrl)
               .setBranch(branch)
               .setDirectory(projectDir)
               .setCredentialsProvider(provider)
               .setProgressMonitor(new CloneProgressMonitor())
               .call()) {
       	
       }
       
       return true;
}
 
Example #8
Source File: GitRepository.java    From Getaviz with Apache License 2.0 6 votes vote down vote up
private File cloneToTmpDir(String pathToRemoteGitRepository) throws GitAPIException, InvalidRemoteException, TransportException {
	File localDir;
	TmpDirCreator tmpDirCreator = new TmpDirCreator(pathToRemoteGitRepository);
	localDir = tmpDirCreator.getLocalTempDir();
	if(!localDir.exists()){
		messageOutputStream.println("Caching git repository " + pathToRemoteGitRepository + "...");
		Git.cloneRepository().setURI(pathToRemoteGitRepository)
							 .setDirectory(localDir)
							 .setProgressMonitor(new GitProgressMonitor())
							 .call();
		localDir.mkdirs();
		messageOutputStream.println("\nCaching finished succesfully...");
		tmpDirCreator.writeIdFileToTempDir();
	}
	return localDir;
}
 
Example #9
Source File: GitWorkspaceSync.java    From milkman with MIT License 6 votes vote down vote up
private Git refreshRepository(GitSyncDetails syncDetails, File syncDir)
		throws GitAPIException, InvalidRemoteException, TransportException, IOException,
		WrongRepositoryStateException, InvalidConfigurationException, CanceledException, RefNotFoundException,
		RefNotAdvertisedException, NoHeadException {
	Git repo;
	if (!syncDir.exists()) {
		syncDir.mkdirs();
		repo = initWith(Git.cloneRepository(), syncDetails)
			.setURI(syncDetails.getGitUrl())
			.setDirectory(syncDir)
			.setCloneAllBranches(true)
			.setBranch("master")
			.call();
		
		
	} else {
		repo = Git.open(syncDir);
		initWith(repo.pull(), syncDetails)
			.call();
	}
	return repo;
}
 
Example #10
Source File: UIGit.java    From hop with Apache License 2.0 6 votes vote down vote up
public boolean cloneRepo( String directory, String uri ) {
  CloneCommand cmd = Git.cloneRepository();
  cmd.setDirectory( new File( directory ) );
  cmd.setURI( uri );
  cmd.setCredentialsProvider( credentialsProvider );
  try {
    Git git = cmd.call();
    git.close();
    return true;
  } catch ( Exception e ) {
    if ( ( e instanceof TransportException )
        && ( ( e.getMessage().contains( "Authentication is required but no CredentialsProvider has been registered" )
          || e.getMessage().contains( "not authorized" ) ) ) ) {
      if ( promptUsernamePassword() ) {
        return cloneRepo( directory, uri );
      }
    } else {
      showMessageBox( BaseMessages.getString( PKG, "Dialog.Error" ), e.getMessage() );
    }
  }
  return false;
}
 
Example #11
Source File: GitUtil.java    From Jpom with MIT License 5 votes vote down vote up
/**
 * 拉取对应分支最新代码
 *
 * @param url                 远程url
 * @param file                仓库路径
 * @param branchName          分支名
 * @param credentialsProvider 凭证
 * @throws IOException     IO
 * @throws GitAPIException api
 */
public static void checkoutPull(String url, File file, String branchName, CredentialsProvider credentialsProvider) throws IOException, GitAPIException {
    try (Git git = initGit(url, file, credentialsProvider)) {
        // 判断本地是否存在对应分支
        List<Ref> list = git.branchList().setListMode(ListBranchCommand.ListMode.ALL).call();
        boolean createBranch = true;
        for (Ref ref : list) {
            String name = ref.getName();
            if (name.startsWith(Constants.R_HEADS + branchName)) {
                createBranch = false;
                break;
            }
        }
        // 切换分支
        if (!StrUtil.equals(git.getRepository().getBranch(), branchName)) {
            git.checkout().
                    setCreateBranch(createBranch).
                    setName(branchName).
                    setForceRefUpdate(true).
                    setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.SET_UPSTREAM).
                    call();
        }
        git.pull().setCredentialsProvider(credentialsProvider).call();
    } catch (TransportException t) {
        checkTransportException(t);
        throw t;
    }
}
 
Example #12
Source File: XacmlAdminUI.java    From XACML with MIT License 5 votes vote down vote up
/**
   * Initializes a user's git repository.
   * 
   * 
   * @param workspacePath
   * @param userId
   * @param email
   * @return
   * @throws IOException
   * @throws InvalidRemoteException
   * @throws TransportException
   * @throws GitAPIException
   */
  private static Path initializeUserRepository(Path workspacePath, String userId, URI email) throws IOException, InvalidRemoteException, TransportException, GitAPIException {
  	Path gitPath = null;
//
// Initialize the User's Git repository
//
if (Files.notExists(workspacePath)) {
	logger.info("Creating user workspace: " + workspacePath.toAbsolutePath().toString());
	//
	// Create our user's directory
	//
	Files.createDirectory(workspacePath);
}
gitPath = Paths.get(workspacePath.toString(), XacmlAdminUI.repositoryPath.getFileName().toString());
if (Files.notExists(gitPath)) {
	//
	// It doesn't exist yet, so Clone it and check it out
	//
	logger.info("Cloning user git directory: " + gitPath.toAbsolutePath().toString());
	Git.cloneRepository().setURI(XacmlAdminUI.repositoryPath.toUri().toString())
					.setDirectory(gitPath.toFile())
					.setNoCheckout(false)
					.call();
	//
	// Set userid
	//
	Git git = Git.open(gitPath.toFile());
	StoredConfig config = git.getRepository().getConfig();
	config.setString("user", null, "name", userId);
	if (email != null && email.getPath() != null) {
		config.setString("user", null, "email", email.toString());
	}
	config.save();
}
return gitPath;
  }
 
Example #13
Source File: JGitEnvironmentRepositoryConcurrencyTests.java    From spring-cloud-config with Apache License 2.0 5 votes vote down vote up
@Override
public FetchResult call()
		throws GitAPIException, InvalidRemoteException, TransportException {
	try {
		Thread.sleep(250);
	}
	catch (InterruptedException e) {
		e.printStackTrace();
	}
	return super.call();
}
 
Example #14
Source File: JGitEnvironmentRepositoryConcurrencyTests.java    From spring-cloud-config with Apache License 2.0 5 votes vote down vote up
@Override
public Git call()
		throws GitAPIException, InvalidRemoteException, TransportException {
	try {
		Thread.sleep(250);
	}
	catch (InterruptedException e) {
		e.printStackTrace();
	}
	return super.call();
}
 
Example #15
Source File: RepositoryCloner.java    From compiler with Apache License 2.0 5 votes vote down vote up
public static void clone(String[] args)
			throws IOException, InvalidRemoteException, TransportException, GitAPIException {
		// prepare a new folder for the cloned repository
		String localPath = args[1];
		String url = args[0];
		File localGitDir = new File(localPath + "/.git");
		// then clone
		Git result = null;

		java.lang.System.setProperty("https.protocols", "TLSv1,TLSv1.1,TLSv1.2");
		try {
			result = Git.cloneRepository().setURI(url).setBare(true).setDirectory(localGitDir).call();
			// Note: the call() returns an opened repository already which
			// needs
			// to be closed to avoid file handle leaks!
			// workaround for
			// https://bugs.eclipse.org/bugs/show_bug.cgi?id=474093
			result.getRepository().close();
			/*
		} catch (Exception e) {
			System.err.println("Error cloning " + url);
			e.printStackTrace();
			*/
		} finally {
			if (result != null && result.getRepository() != null) {
//				System.out.println("Cloned repo " + url);
				result.getRepository().close();
			}
		} 
	}
 
Example #16
Source File: RepositoryClonerWorker.java    From compiler with Apache License 2.0 5 votes vote down vote up
public void clone(int from, int to)
		throws InvalidRemoteException, TransportException, IOException, GitAPIException {
	String urlHeader = "https://github.com/";
	String urlFooter = ".git";
	String outFilePath = "";
	File dir = new File(inPath);
	File[] files = dir.listFiles();
	for (int i = from; i < to; i++) {
		// System.out.println("Processing file number " + i );
		if (!files[i].getName().endsWith(".json")) {
			continue;
		}
		String content = FileIO.readFileContents(files[i]);
		Gson parser = new Gson();
		JsonArray repos = parser.fromJson(content, JsonElement.class).getAsJsonArray();
		for (int j = 0; j < repos.size(); j++) {
			JsonObject repo = repos.get(j).getAsJsonObject();
			String name = repo.get("full_name").getAsString();
			boolean forked = repo.get("fork").getAsBoolean();
			if (forked)
				continue;
			outFilePath = outPath + "/" + name;
			//File file = new File(outFilePath);
			if (names.contains(name)){
				names.remove(name);
				continue;
			}
			String[] args = { urlHeader + name + urlFooter, outFilePath };
			RepositoryCloner.clone(args);
			FileIO.writeFileContents(recovory, name + "/n" , true);
		}
	}
}
 
Example #17
Source File: VersionControlGit.java    From mdw with Apache License 2.0 5 votes vote down vote up
public void fetch() throws Exception {
    if (allowFetch) {
        FetchCommand fetchCommand = git.fetch().setRemoveDeletedRefs(true);
        if (credentialsProvider != null)
            fetchCommand.setCredentialsProvider(credentialsProvider);
        try {
            fetchCommand.call();
        }
        catch (JGitInternalException | TransportException ex) {
            // LocalRepo object might be out of sync with actual local repo, so recreate objects for next time
            reconnect();
            throw ex;
        }
    }
}
 
Example #18
Source File: GitRepoCloner.java    From multiapps-controller with Apache License 2.0 5 votes vote down vote up
public void cloneRepo(final String gitUri, final Path repoDir) throws GitAPIException, IOException {
    if (repoDir.toFile()
               .exists()) {
        LOGGER.debug(MessageFormat.format("Deleting left-over repo dir {0}", repoDir.toAbsolutePath()));
        com.sap.cloud.lm.sl.cf.core.util.FileUtils.deleteDirectory(repoDir);
    }

    configureGitSslValidation();
    if (refName != null && !refName.isEmpty()) {
        String fullRefName = refName.startsWith("refs/") ? refName : "refs/heads/" + refName;
        cloneCommand.setBranchesToClone(Collections.singletonList(fullRefName));
        cloneCommand.setBranch(fullRefName);
    }
    cloneCommand.setTimeout(290);
    cloneCommand.setDirectory(repoDir.toAbsolutePath()
                                     .toFile());
    cloneCommand.setURI(gitUri);
    LOGGER.debug(MessageFormat.format("cloning repo with url {0} in repo dir {1} ref '{2}'", gitUri, repoDir.toAbsolutePath()));
    try (Git callInstance = cloneCommand.call()) {
        Repository repo = callInstance.getRepository();
        repo.close();
    } catch (TransportException e) {
        Throwable cause1 = e.getCause();
        if (cause1 != null && cause1.getCause() instanceof SSLHandshakeException) {
            throw new SLException(cause1.getCause(), "Failed to establish ssl connection"); // NOSONAR
        }
        throw e;
    }
}
 
Example #19
Source File: GitUtils.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
private static void pull(final Git git, ProgressMonitor monitor)
		throws GitAPIException, WrongRepositoryStateException,
		InvalidConfigurationException, InvalidRemoteException, CanceledException, RefNotFoundException,
		RefNotAdvertisedException, NoHeadException, TransportException {

	git.pull().setTransportConfigCallback(TRANSPORT_CALLBACK).setProgressMonitor(monitor).call();
}
 
Example #20
Source File: GitUtils.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
private static void pull(final Git git, IProgressMonitor monitor)
		throws GitAPIException, WrongRepositoryStateException,
		InvalidConfigurationException, InvalidRemoteException, CanceledException, RefNotFoundException,
		RefNotAdvertisedException, NoHeadException, TransportException {

	@SuppressWarnings("restriction")
	ProgressMonitor gitMonitor = (null == monitor) ? createMonitor()
			: new org.eclipse.egit.core.EclipseGitProgressTransformer(monitor);
	pull(git, gitMonitor);
}
 
Example #21
Source File: JGitUtil.java    From mcg-helper with Apache License 2.0 5 votes vote down vote up
public static boolean pull(String projectPath, String branch, String user, String pwd) throws IOException, WrongRepositoryStateException, InvalidConfigurationException, InvalidRemoteException, CanceledException, RefNotFoundException, RefNotAdvertisedException, NoHeadException, TransportException, GitAPIException {

		try (Git git = Git.open(new File(projectPath)) ) {
			UsernamePasswordCredentialsProvider provider = new UsernamePasswordCredentialsProvider(user, pwd);
			git.pull().setRemoteBranchName(branch)
					.setCredentialsProvider(provider)
					.setProgressMonitor(new PullProgressMonitor())
					.call();
		}
		
		return true;
	}
 
Example #22
Source File: CreatureLab.java    From BowlerStudio with GNU General Public License v3.0 4 votes vote down vote up
public void setGitCadEngine(String gitsId, String file, DHParameterKinematics dh)
		throws InvalidRemoteException, TransportException, GitAPIException, IOException {
	baseManager.setGitCadEngine(gitsId, file, dh);
}
 
Example #23
Source File: CreatureLab.java    From BowlerStudio with GNU General Public License v3.0 4 votes vote down vote up
public void setGitCadEngine(String gitsId, String file, MobileBase device)
		throws InvalidRemoteException, TransportException, GitAPIException, IOException {
	baseManager.setGitCadEngine(gitsId, file, device);
}
 
Example #24
Source File: MobleBaseMenueFactory.java    From BowlerStudio with GNU General Public License v3.0 4 votes vote down vote up
private static void openCadTab(CreatureLab creatureLab, String gitsId, String file)
		throws InvalidRemoteException, TransportException, GitAPIException, IOException {
	File code = ScriptingEngine.fileFromGit(gitsId, file);
	ScriptingFileWidget wid = BowlerStudio.createFileTab(code);

}
 
Example #25
Source File: GitPullTests.java    From nano-framework with Apache License 2.0 4 votes vote down vote up
@Test
public void pullTest() throws InvalidRemoteException, TransportException, GitAPIException, IOException {
    GitPull.create().quickPull();
}
 
Example #26
Source File: GitUtils.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
private static void pull(final Git git) throws GitAPIException, WrongRepositoryStateException,
		InvalidConfigurationException, InvalidRemoteException, CanceledException, RefNotFoundException,
		RefNotAdvertisedException, NoHeadException, TransportException {

	pull(git, (ProgressMonitor) null);
}
 
Example #27
Source File: GitUtil.java    From Jpom with MIT License 4 votes vote down vote up
private static void checkTransportException(TransportException ex) {
    String msg = ex.getMessage();
    if (msg.contains(JGitText.get().notAuthorized) || msg.contains(JGitText.get().authenticationNotSupported)) {
        throw new JpomRuntimeException("git账号密码不正常", ex);
    }
}
 
Example #28
Source File: Push.java    From wandora with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void execute(Wandora wandora, Context context) {
    
    try {
        Git git = getGit();
        if(git != null) {
            if(isNotEmpty(getGitRemoteUrl())) {
                if(pushUI == null) {
                    pushUI = new PushUI();
                }

                pushUI.setPassword(getPassword());
                pushUI.setUsername(getUsername());
                pushUI.setRemoteUrl(getGitRemoteUrl());
                pushUI.openInDialog();

                if(pushUI.wasAccepted()) {
                    setDefaultLogger();
                    setLogTitle("Git push");

                    String username = pushUI.getUsername();
                    String password = pushUI.getPassword();
                    String remoteUrl = pushUI.getRemoteUrl();

                    setUsername(username);
                    setPassword(password);
                    // setGitRemoteUrl(remoteUrl);

                    PushCommand push = git.push();

                    log("Pushing local changes to upstream.");
                    if(username != null && username.length() > 0) {
                        CredentialsProvider credentialsProvider = new UsernamePasswordCredentialsProvider( username, password );
                        push.setCredentialsProvider(credentialsProvider);
                    }

                    Iterable<PushResult> pushResults = push.call();

                    for(PushResult pushResult : pushResults) {
                        String pushResultMessage = pushResult.getMessages();
                        if(isNotEmpty(pushResultMessage)) {
                            log(pushResultMessage);
                        }
                    }
                    log("Ready.");
                }
            }
            else {
                log("Repository has no remote origin and can't be pushed. " 
                    +"Initialize repository by cloning remote repository to set the remote origin.");
            }
        }
        else {
            logAboutMissingGitRepository();
        }
    }
    catch(TransportException tre) {
        if(tre.toString().contains("origin: not found.")) {
            log("Git remote origin is not found. Check the remote url and remote git repository.");
        }
    }
    catch(GitAPIException gae) {
        log(gae.toString());
    }
    catch(NoWorkTreeException nwte) {
        log(nwte.toString());
    }
    catch(Exception e) {
        log(e);
    }
    setState(WAIT);
}
 
Example #29
Source File: GitService.java    From Refactoring-Bot with MIT License 4 votes vote down vote up
/**
 * This method performs 'git push' programmically
 * 
 * @throws GitWorkflowException
 */
public void commitAndPushChanges(GitConfiguration gitConfig, String commitMessage) throws GitWorkflowException {
	try (Git git = Git.open(new File(botConfig.getBotRefactoringDirectory() + gitConfig.getConfigurationId()))) {
		StoredConfig storedRepoConfig = git.getRepository().getConfig();
		// set autocrlf to true to handle line endings of different operating systems
		// correctly. Otherwise the bot will most likely change the line endings of all
		// files to the default of its operating system.
		// Corresponds to 'git config --global core.autocrlf true'
		storedRepoConfig.setEnum(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_AUTOCRLF,
				AutoCRLF.TRUE);
		// set filemode explicitly to false
		storedRepoConfig.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_FILEMODE,
				false);
		storedRepoConfig.save();

		// We only add those files to the staging area that have actually been changed.
		// 'git add .' in this JGit config would sometimes cause files to be added
		// without content changes (e.g. due to unpredictable whitespace changes).
		List<DiffEntry> diffEntries = git.diff().call();
		for (DiffEntry diffEntry : diffEntries) {
			git.add().addFilepattern(diffEntry.getOldPath()).call();
		}

		// 'git commit -m'
		git.commit().setMessage(commitMessage).setCommitter(gitConfig.getBotName(), gitConfig.getBotEmail()).call();

		// push with bot credentials
		if (gitConfig.getRepoService().equals(FileHoster.github)) {
			git.push().setCredentialsProvider(new UsernamePasswordCredentialsProvider(gitConfig.getBotToken(), ""))
					.call();
		} else {
			git.push().setCredentialsProvider(
					new UsernamePasswordCredentialsProvider(gitConfig.getBotName(), gitConfig.getBotToken()))
					.call();
		}
	} catch (TransportException t) {
		logger.error(t.getMessage(), t);
		throw new GitWorkflowException("Wrong bot token!");
	} catch (Exception e) {
		logger.error(e.getMessage(), e);
		throw new GitWorkflowException("Could not successfully perform 'git push'!");
	}
}