JGIT validate if repository is valid
java, jgit, validation
Solution
you can invoke 'git ls-remote ' using JGIT. see at here
Sample code as below:
final LsRemoteCommand lsCmd = new LsRemoteCommand(null);
final List<String> repos = Arrays.asList(
"https://github.com/MuchContact/java.git",
"git@github.com:MuchContact/java.git");
for (String gitRepo: repos){
lsCmd.setRemote(gitRepo);
System.out.println(lsCmd.call().toString());
}
Problem
Is there a method to kill a clone operation mid-stream? I will just use the cloning to validate the repository? Is there any other way to test if the remote url/repository is valid?