-2

I want to access the remote repo files of all branches to analyze the committed code without cloning to the local through java. How can I achieve this one and what is the procedure if there any way to do?

Thanks in advance.

Rock Star
  • 31
  • 4
  • Possible duplicate of [Viewing file from Git using JGIT remotely without creating local repo](https://stackoverflow.com/questions/19414568/viewing-file-from-git-using-jgit-remotely-without-creating-local-repo) – Rüdiger Herrmann May 23 '17 at 20:01
  • Thank you I will check with this – Rock Star May 24 '17 at 01:53

1 Answers1

0

Try scm4j-vcs-git:

public static final String WORKSPACE_DIR = System.getProperty("java.io.tmpdir") + "git-workspaces";
...
IVCSWorkspace workspace = new VCSWorkspace(WORKSPACE_DIR);
String repoUrl = "https://github.com/MyUser/MyRepo";
IVCSRepositoryWorkspace repoWorkspace = workspace.getVCSRepositoryWorkspace(repoUrl);
IVCS vcs = new GitVCS(repoWorkspace);
vcs.setCredentials("user", "password"); // if necessary
vcs.getBranchesList();
host.13
  • 108
  • 1
  • 1
  • 11