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:
- 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.
- Download and install Git SCM (or use any other git client you might like)
- 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
- Edit and amend the index.html page as required. Mine looks like this
- Copy the javadoc folder to the local repository
- Add it to your repo, commit and push:
$ git add apidocs
$ git commit -a
$ git push --repo=https://github.com/assylias/jBloomberg.git
- 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.emailglobal 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
: xto exit and save.