Upload javadoc to github

I have uploaded a new project to github yesterday but wanted to find a way to also add a way to link to a browsable javadoc.

I have generated the javadoc from Netbeans (using Maven site:site) and the question was how to upload it to github. I used the following steps:

  1. Create a gh page on github: on the project page > Settings > GitHub Pages > Automatic Page Generator. That creates a new branch to the project which can contain HTML documentation.
  2. Download and install Git SCM (or use any other git client you might like)
  3. Once the email confirming the creation of the page is received, clone the gh-page branch to the local computer – I did it from Netbeans but I think the command is (from the git client):
    $ cd your_repo_root/repo_name
    $ git fetch origin
    $ git checkout gh-pages
  4. Edit and amend the index.html page as required. Mine looks like this
  5. Copy the javadoc folder to the local repository
  6. Add it to your repo, commit and push:
    $ git add apidocs
    $ git commit -a
    $ git push --repo=https://github.com/assylias/jBloomberg.git
  7. Add a link to those beautiful pages in your README.md file, which appears on the project’s main page, and you’re done.


  • I had to setup the user.name and user.email global parameters before committing, but it was clearly indicated by an error message.
  • The commit message in Git SCM is done in a VIM like environment => type I to insert the message then ESC to exit the editing mode and : x to exit and save.
Tagged , ,

One thought on “Upload javadoc to github

  1. Emptyfruit says:

    Nice article, thank you. But in result, have a problem, that my IDEA-generated Javadoc pages loose connection with resources. Images and stylesheets won’t load.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: