The documentation requires a slight updation. Here we need to pass a URI in the second parameter of the method .
final GitHubClient githubClient =
GitHubClient.create(
URI.create("https://api.github.com/"),
new File("/path-to-the/private-key.pem"), // here we need to convert the path to a URI
APP_ID);