Ad

Getting An Git Related Error When Trying To Build Or Serve With New Theme

- 1 answer

Description:

For some reason, I can't build or serve my jekyll site without "configuring a repo name". I have no clue why there would be a repo name needed for a local build or how to add the repo name.

This is the first time this happened. I tried to migrate the default site from "minima" to "jekyll-theme-primer". When I fired it up in minima it outputted me the default side. I migrated the default post, index.md and about to layout default. It does not fire up and throws me this error. Can somebody specify how to move on from here?

Input:

jekyll -v: jekyll 3.7.2

Expected behaviour:

Tobiass-MBP:tobi.codes Tobias$ bundle exec jekyll serve
Configuration file: /Users/Tobias/Jekyll Blog/tobi.codes/_config.yml
            Source:  /Users/Tobias/Jekyll Blog/tobi.codes/
       Destination:  /Users/Tobias/Jekyll Blog/tobi.codes/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
                    done in 0.62 seconds.
 Auto-regeneration: enabled for ' /Users/Tobias/Jekyll Blog/tobi.codes/'
    Server address: http://127.0.0.1:4000/
  Server running... press ctrl-c to stop.

Actual behaviour:

Tobiass-MBP:tobi.codes Tobias$ bundle exec jekyll serve
Configuration file: /Users/Tobias/Jekyll Blog/tobi.codes/_config.yml
            Source: /Users/Tobias/Jekyll Blog/tobi.codes
       Destination: /Users/Tobias/Jekyll Blog/tobi.codes/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
  Liquid Exception: No repo name found. Specify using PAGES_REPO_NWO environment variables, 'repository' in your configuration, or set up an 'origin' git remote pointing to your github.com repository. in /_layouts/default.html
             ERROR: YOUR SITE COULD NOT BE BUILT:
                    ------------------------------------
                    No repo name found. Specify using PAGES_REPO_NWO environment variables, 'repository' in your configuration, or set up an 'origin' git remote pointing to your github.com repository.
Ad

Answer

The jekyll-theme-primer theme uses jekyll-github-metadata plugin.

The error happens in default layout when site.github is called, because you did not configure it.

You can get rid of this error by copying this file in _layouts/default.html and removing lines 19 to 23.

{% if site.github.private != true and site.github.license %}
<div class="footer border-top border-gray-light mt-5 pt-3 text-right text-gray">
  This site is open source. {% github_edit_link "Improve this page" %}.
</div>
{% endif %}
Ad
source: stackoverflow.com
Ad