org.eclipse.jgit.api.GitCommand Java Examples
The following examples show how to use
org.eclipse.jgit.api.GitCommand.
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: JGitUtil.java From milkman with MIT License | 5 votes |
public static<R extends TransportCommand<C, T>, C extends GitCommand<T>, T> R initWith(R cmd, GitSyncDetails sync){ if (sync.isSsh()) { cmd.setTransportConfigCallback(new SshTransportConfigCallback(sync.getUsername(), sync.getPasswordOrToken())); if (StringUtils.isNotBlank(sync.getPasswordOrToken())) { cmd.setCredentialsProvider(new UsernamePasswordCredentialsProvider(sync.getUsername(), sync.getPasswordOrToken())); } } else { cmd.setCredentialsProvider(new UsernamePasswordCredentialsProvider(sync.getUsername(), sync.getPasswordOrToken())); } return cmd; }
Example #2
Source File: AbstractGitTask.java From ant-git-tasks with Apache License 2.0 | 5 votes |
/** * Setups the Git credentials if specified and needed * * @param command The git command to configure */ @SuppressWarnings("rawtypes") protected void setupCredentials(GitCommand<?> command) { GitSettings settings = lookupSettings(); if (settings != null && command instanceof TransportCommand) { TransportCommand cmd = (TransportCommand) command; cmd.setCredentialsProvider(settings.getCredentials()); } }