We follow the below steps to import a Local Git project in Eclipse:
File -> Import -> Git -> Projects From Git > Existing local repository
How can we achieve the same using a Java program?
I used org.eclipse.core.resources to import the project by giving the path of a .project file but it doesn't give Git connectivity.
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = workspace.getRoot();
IProject project = root.getProject("myProject/.project"); // path to .project file
project.create(new NullProgressMonitor());
project.open(null);
I also went through JGit Docs, but didn't find any solution