对于托管在Github Pages上的Jekyll博客,其Gemfile如下:
source 'https://rubygems.org'
gem 'github-pages', group: :jekyll_plugins
该配置在被Netlify导入并构建站点时会出现类似于如下的错误:
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/post.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.
解决方案是删除Gemfile.lock
并将上述Gemfile中第二行注释,并手动加入该Jekyll主题所需要的库,大致形式如下:
source 'https://rubygems.org'
# gem 'github-pages', group: :jekyll_plugins
gem 'jekyll'
gem 'jekyll-paginate'
gem 'jekyll-gist'