Fix the errors of GitHub Metadata and SSL certificate when running Jekyll serve

octojekyll

I decided to play with Jekyll today. It is an amazing static site generator. I ran local server by execute this command:

$> jekyll serve

I could browse my site locally then. When I had updated one of my files, Jekyll stated regenerating the output HTML file and I got this errors on the command line window.

GitHub Metadata: No GitHub API authentication could be found. Some fields may be missing or have incorrect data.

Error: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

Error: Run jekyll build –trace for more information.

As I am not familiar with Ruby, it took me an hour to investigate and fix this problem. Actually, there are one warning and one error in the message above.

GitHub Metadata warning

GitHub Metadata is a gem required by Jekyll. We need a GitHub personal token to make it work. Follow the excellent guide on GitHub to create a token, copy it to a safe place.

Now, create new environment variable in your system named JEKYLL_GITHUB_TOKEN with the value pasted from the created token. Open a new instance of command line and make sure this command displays correct information (I use Windows machine).

$>echo %JEKYLL_GITHUB_TOKEN%

You can read more at the GitHub Metadata README file.

OpenSSL default certificate error

Please do not do these steps in a production server!

Now, down load the .pem file from https://curl.haxx.se/ca/cacert.pem. Then, create another environment variable called SSL_CERT_FILE pointing to the location of downloaded .pem file.

Open new instance of command line window and run this command, be sure that there is no error now.

$> ruby -rnet/https -e "Net::HTTP.get URI('https://github.com')"

Conclusion

With the steps above, I resolved my problems with Jekyll server command. If you try and find any trouble with them, please let me know by leaving comments at the bottom of the post.

5 comments

  1. francis on

    Thank you for attempting to provide a fix for this problem. However, the following information is not clear:

    …Now, create new environment variable in your system named JEKYLL_GITHUB_TOKEN with the value pasted from the created token. Open a new instance of command line and make sure this command displays correct information (I use Windows machine).

    $>echo %JEKYLL_GITHUB_TOKEN%

    How do you create an “environmental variable in your system”?

    I have attempted
    $ JEKYLL_GITHUB_TOKEN = sadfadf

    As well as
    JEKYLL_GITHUB_TOKEN: sadasdfsadf
    in _config.yml

    Neither has worked.

    Thank you for your time,
    Francis

    Reply
  2. glen perry on

    great post. really has been a help to me getting this running. however, auto-regeneration isn’t working for me. when i check for errors with OpenSSL certificate (with verbose info) I get this:

    C:/Ruby22-x64/lib/ruby/2.2.0/net/http.rb:895: warning: instance variable @npn_protocols not initialized
    C:/Ruby22-x64/lib/ruby/2.2.0/net/http.rb:895: warning: instance variable @npn_select_cb not initialized

    So basically my github metadata can’t initialize. I barely understand what this means. But maybe you do? I realize this is a long shot.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *