Skip to content

Instantly share code, notes, and snippets.

@keesun
Last active December 16, 2015 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keesun/5486780 to your computer and use it in GitHub Desktop.
Save keesun/5486780 to your computer and use it in GitHub Desktop.
jgit clone
public void cloneRepository(Project originalProject, Project forkingProject) throws GitAPIException, IOException {
String url = // original project's git url
String directory = "repo/git/" + forkingProject.owner + "/" + forkingProject.name;
Git.cloneRepository()
.setURI(url)
.setDirectory(new File(directory))
.setCloneAllBranches(true)
.call();
forkingProject.repositoryUrl = directory + "/.git";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment