Fixing the Jekyll + GitHub Metadata warning
We can set up a local version of our Jekyll GitHub Pages website to preview our website before making the changes public. But when I run the
jekyll serve command it throws the following error message:
GitHub Metadata: No GitHub API authentication could be found. Some fields may be missing or have incorrect data.
Here’s the solution to fix this warning:
Creating a GitHub personal access token.
In the upper-right corner of any page, click your profile photo, then click
In the left sidebar, click
In the left sidebar, click
Personal access tokens.
Generate new token.
Give your token a descriptive name.
Select the scopes, or permissions, you’d like to grant this token. I will select the
Copy the token to your clipboard. For security reasons, after you navigate off the page, you will not be able to see the token again.
Note! Treat your tokens like passwords and keep them secret (if you don’t want other people to use the API on your behalf). When working with the API, use tokens as environment variables instead of hardcoding them into your programmes.
~/.bash_profile file (you can use your favourite text editor instead of
nano if you’d like).
Note: This file may have different names and locations depending on your shell and OS. For example:
.zshenv. In MacOS is a
.bash_profilethat loacated at user home directory (
~/). You can search in Google for information about file in your OS in wich you can add a new environment variable.
Then define new environment variable with variable name
JEKYLL_GITHUB_TOKEN and GitHub access token as variable value (which is something like
abc123def456). You can do this by add the following line to a new blank line:
Note: Replace the
abc123def456with your token.
Now reload the Terminal.
You can check the new environment variable with the following command line that should display your GitHub token.
For security reason you can also access GitHub token with the following command line while building or serving Jekyll website:
JEKYLL_GITHUB_TOKEN=abc123def456 bundle exec jekyll serve
Also you can set temporary environment variable with the following command line:
export command run by itself and not contained within
.bash_profile will only be a temporary setting and the environment variable will not persist unless you add it to the
If you are having trouble fixing this problem with the instructions above, but are being able to solve this problem with any another method please describe it in the comment section below. Thanks!
If this article has helped you solve the problem then please leave a comment
Thanks for reading!
Arthur is a designer and full stack software engineer. He is the founder of Space X-Chimp and the blog My Cyber Universe. His personal website can be found at arthurgareginyan.com.