Search code examples
githubbundlerjekyllgithub-pages

Jekyll won't build if gemfile exists


I'm working on my Github Pages site, so need to build it on my local machine. Following their instructions, I have set it up using bundler. However bundler appears to break the Jekyll build.

If I run jekyll new NewSite it creates a new site that can be built using jekyll serve. As soon as I run bundle install, or bundle update, however, Jekyll refuses to run, giving the below error on the "generating" step.

jekyll 3.0.5 | Error:  No such file or directory - git remote --verbose

It will then give that same error every time either bundle exec jekyll serve or jekyll serve are called. Further investigation has found that the error goes away if the gemfile file is deleted.

What have I misconfigured?

Update:

  1. I've added a stack trace as requested
  2. I realised it was the gemfile itself that was causing the issue, not the gemfile.lock
  3. Problem turned out to have nothing to do with Windows, so removed references to it

Stack trace:

C:/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-github-metadata-1.11.1/lib/jekyll-github-metadata/ghp_metadata_generator.rb:32
:in ``': No such file or directory - git remote --verbose (Errno::ENOENT)
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-github-metadata-1.11.1/lib/jekyll-github-metadata/ghp_metadata_generator.rb:32:in `git_remote_url'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-github-metadata-1.11.1/lib/jekyll-github-metadata/ghp_metadata_generator.rb:39:in `nwo_from_git_origin_remote'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-github-metadata-1.11.1/lib/jekyll-github-metadata/ghp_metadata_generator.rb:65:in `nwo'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-github-metadata-1.11.1/lib/jekyll-github-metadata/ghp_metadata_generator.rb:8:in `generate'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.5/lib/jekyll/site.rb:154:in `block in generate'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.5/lib/jekyll/site.rb:153:in `each'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.5/lib/jekyll/site.rb:153:in `generate'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.5/lib/jekyll/site.rb:58:in `process'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.5/lib/jekyll/command.rb:28:in `process_site'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.5/lib/jekyll/commands/build.rb:60:in `build'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.5/lib/jekyll/commands/build.rb:35:in `process'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.5/lib/jekyll/commands/serve.rb:26:in `block (2 levels) in init_with_program'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `call'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/jekyll-3.0.5/bin/jekyll:17:in `<top (required)>'
    from C:/Ruby22/bin/jekyll:23:in `load'
    from C:/Ruby22/bin/jekyll:23:in `<main>'

My Gemfile:

source 'https://rubygems.org'
gem 'github-pages', group: :jekyll_plugins
gem 'safe_yaml', '~> 1.0.4'
gem 'wdm', '~> 0.1.0' if Gem.win_platform?

Ruby version: 2.2.4 32 bit

Bundler version: 1.12.3

Jekyll Version: 3.0.5


Solution

  • This is jekyll-github-metadata gem which is bugging when trying to run a git remote --verbose command on your system (code).

    You can try to set a _config.yml variable (documentation) :

    repository: username/repo-name