Skip to main content



      Home
Home » Eclipse Projects » EGit / JGit » GitHub Wiki and jGit
GitHub Wiki and jGit [message #1404260] Wed, 30 July 2014 13:36 Go to next message
Eclipse UserFriend
Is it possible to access GitHub Wiki using jGit?

Let's take for example https://github.com/radiant/radiant/wiki. There are titles like "Installation", "The Basics", "Extensions", etc., links to other sites (as you can see on the right) and the corresponding descriptions.
How can I retrieve and parse those information with jGit?
I know how to access Git repositories with jGit, but I'm not sure if it's possible to access the GitHub Wiki as well.

This is what I have so far:

Repository repository = null;

try {
	File localPath = File.createTempFile("TestGitRepository", "");
	localPath.delete();

	Git.cloneRepository()
			.setURI("https://github.com/radiant/radiant.wiki.git") 
			.setDirectory(localPath).call();

	Git git = Git.open(localPath);
	repository = git.getRepository();

} catch (IOException | GitAPIException e) {
	System.err.println("Caught Exception: " + e.getMessage());
	e.printStackTrace();
} finally {
	repository.close(); // Exception
}


But I get a java.lang.NullPointerException at repository.close();.

Thank you.

[Updated on: Wed, 30 July 2014 14:24] by Moderator

Re: GitHub Wiki and jGit [message #1404276 is a reply to message #1404260] Wed, 30 July 2014 16:32 Go to previous message
Eclipse UserFriend
I tried your example and it works perfectly well, though if you hit an exception
the variable "repository" is null and you will hit NPE when trying to close the
repository. Add a null check to fix this.

Maybe some RuntimeException is thrown, in this case no stack trace will be
printed since you only catch checked exceptions.

Maybe you are lacking proxy settings ?
Previous Topic:Issue with Configure Git repository
Next Topic:Committed changes to branch, now won't let me push upstream
Goto Forum:
  


Current Time: Sun Jul 13 14:40:41 EDT 2025

Powered by FUDForum. Page generated in 0.04009 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top