use of org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider in project Corgi by kevinYin.
the class JGitTest method testClone.
@Test
public void testClone() throws IOException, GitAPIException {
long begin = System.currentTimeMillis();
CredentialsProvider cp = new UsernamePasswordCredentialsProvider("kevin", "111");
Git cloneGit = Git.cloneRepository().setURI(remotePath).setCredentialsProvider(cp).setBranch("20170329_testBranch").setDirectory(new File(localPath)).call();
long time = System.currentTimeMillis() - begin;
System.out.println(time);
}
use of org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider in project Corgi by kevinYin.
the class JGitTest method testGetVersion.
@Test
public void testGetVersion() throws Exception {
Repository existingRepo = new FileRepositoryBuilder().setGitDir(new File("/Users/kevin/beiliao/gitlab/platform-parent/.git")).build();
Git git = new Git(existingRepo);
CredentialsProvider cp = new UsernamePasswordCredentialsProvider("K-Priest", "kevin711");
Collection<Ref> refs = git.lsRemote().setCredentialsProvider(cp).setRemote("origin").call();
for (Ref ref : refs) {
System.out.println(ref.getObjectId().getName());
}
}
use of org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider in project Corgi by kevinYin.
the class JGitTest method testRemoteInfoWithoutClone.
@Test
public void testRemoteInfoWithoutClone() throws GitAPIException {
CredentialsProvider cp = new UsernamePasswordCredentialsProvider("K-Priest", "kevin711");
Collection<Ref> refs = Git.lsRemoteRepository().setHeads(true).setCredentialsProvider(cp).setRemote("git@gits.ibeiliao.net:platform/platform-parent.git").setTags(true).call();
for (Ref ref : refs) {
System.out.println(ref.getName());
System.out.println(ref.getObjectId().getName());
}
}
use of org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider in project archi-modelrepository-plugin by archi-contribs.
the class ArchiRepository method fetchFromRemote.
@Override
public FetchResult fetchFromRemote(String userName, String userPassword, ProgressMonitor monitor, boolean isDryrun) throws IOException, GitAPIException {
try (Git git = Git.open(getLocalRepositoryFolder())) {
// Check and set tracked master branch
setTrackedMasterBranch(git);
FetchCommand fetchCommand = git.fetch();
fetchCommand.setCredentialsProvider(new UsernamePasswordCredentialsProvider(userName, userPassword));
fetchCommand.setProgressMonitor(monitor);
fetchCommand.setDryRun(isDryrun);
return fetchCommand.call();
}
}
use of org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider in project archi-modelrepository-plugin by archi-contribs.
the class ArchiRepository method cloneModel.
@Override
public void cloneModel(String repoURL, String userName, String userPassword, ProgressMonitor monitor) throws GitAPIException, IOException {
CloneCommand cloneCommand = Git.cloneRepository();
cloneCommand.setDirectory(getLocalRepositoryFolder());
cloneCommand.setURI(repoURL);
cloneCommand.setCredentialsProvider(new UsernamePasswordCredentialsProvider(userName, userPassword));
cloneCommand.setProgressMonitor(monitor);
try (Git git = cloneCommand.call()) {
// Use the same line endings
setConfigLineEndings(git);
}
}
Aggregations