GitHub学习指南

本文介绍了在Windows上遇到的Jekyll安装问题,包括解决找不到gem 'jekyll'的问题,以及如何安装minima和jekyll-feed这两个依赖包。还详细讲解了Jekyll的目录结构,如_sass-cache、_include和_layouts的作用。最后提到了GitHub Education的福利,如namecheap免费域名,并推荐了一系列利用GitHub Pages和Jekyll搭建个人博客的教程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在执行 gem install jekyll报错了
C:\Sites> gem install jekyll
ERROR: Could not find a valid gem ‘jekyll’ (>= 0) in any repository

解决方法$ gem sources --remove RubyGems.org
$ gem sources -a RubyGems.org
$ gem install jekyll 我是这么解决的

然后,我又遇到了两个安装包没有安装的问题

D:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/
resolver.rb:354:in `block in verify_gemfile_dependencies_are_found!': Could not
find gem 'minima (~> 2.0) x86-mingw32' in any of the gem sources listed in your
Gemfile or available on this machine. (Bundler::GemNotFound)
        from D:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2
/lib/bundler/resolver.rb:330:in `each'
        from D:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2
/lib/bundler/resolver.rb:330:in `verify_gemfile_dependencies_are_found!'
        from D:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2
/lib/bundler/resolver.rb:199:in `start'
        from D:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2
/lib/bundler/resolver.rb:183:in `resolve'
        from D:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2
/lib/bundler/definition.rb:198:in `resolve'
        from D:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2
/lib/bundler/definition.rb:137:in `specs'
        from D:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2
/lib/bundler/definition.rb:182:in `specs_for'
        from D:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2
/lib/bundler/definition.rb:171:in `requested_specs'
        from D:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2
/lib/bundler/environment.rb:18:in `requested_specs'
        from D:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2
/lib/bundler/runtime.rb:13:in `setup'
        from D:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2
/lib/bundler.rb:92:in `setup'
        from D:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/jekyll-3.3.0/l
ib/jekyll/plugin_manager.rb:36:in `require_from_bundler'
        from D:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/jekyll-3.3.0/e
xe/jekyll:9:in `<top (required)>'
        from D:/RailsInstaller/Ruby2.2.0/bin/jekyll:23:in `load'
        from D:/RailsInstaller/Ruby2.2.0/bin/jekyll:23:in `<main>'

直接执行gem install minima就行了,还有一个包是gem install jekyll-feed。
Jekyll目录结构解读

这是其他人的目录结构
blog
    .sass-cache
    _includes
        footer.html
        head.html
        header.html
        icon-github.html
        icon-github.svg
        icon-twitter.html
        icon-twitter.svg
    _layouts
        default.html
        page.html
        post.html
    _posts
        2016-06-26-welcome-to-jekyll.markdown
    _sass
    _site
    css
            main.scss
    .gitignore
    _config.yml
    about.md
    feed.xml
    index.html

我的和其他人的不太一样,不过我对比了下其他的首页,一样的,那就没有问题;
这里写图片描述
.sass-cache

sass的编译缓存文件。

_include

网页模块包含文件。可以方便的把这些文件加载到你的布局或者文章中,进行重用。他们都代表了最终生成的网页中的一部分。可以用这个标签:这里写图片描述
来把_include 目录下的文件file.ext包含进来。

_layouts

存放包裹在网页外部的模板。为网站所有网页提供一个基本模板。每个网页只需关注自己的内容。例如 default.html 文件:这里写图片描述
这个文件中包含的就是所有网页文件所共有的东西,每个页面的内容会被填充下面这行代码中:这里写图片描述
在需要使用这个模板的页面中,用YAML头信息进行引用:
这里写图片描述
图中 index.html 文件的头部:
---
layout: default
---

作用是通过 layout 告诉Jekyll生成 index.html 时,要在_layouts 目录下找 default.html 文件,然后把当前文件解析后添加到 default.html 的content 的部分,组成最终的 index.html 文件。

这里写图片描述

附上github education福利。对 Github 个人主页最重要的礼包是 namecheap一年免费域名。当然 Digital ocean 100刀的福利也是棒棒的,ATOM编辑器也是写网站的不二选择。
https://education.github.com/


感觉各位前辈
http://www.ezlippi.com/blog/2015/03/github-pages-blog.html 利用github-pages建立个人博客
http://pwnny.cn/original/2016/06/26/MakeBlog.html Jekyll和Github搭建个人静态博客
http://www.winseliu.com/blog/2014/03/14/windows-install-jekyll/在windows操作系统安装jekyll服务
http://ytysj.github.io/blog/myblog3
http://www.alonemonkey.com/2016/05/20/blog-by-jekyll-hexo/
http://www.jianshu.com/p/4fd3cb0a11da苹果电脑

hexo感谢
模仿http://moxfive.xyz/?qqdrsign=00d3b
http://jiji262.github.io/2016/04/15/2016-04-15-hexo-github-pages-blog/
https://wsgzao.github.io/post/hexo-guide/
https://xuanwo.org/2015/03/26/hexo-intor/
http://blog.fens.me/hexo-blog-github/
https://segmentfault.com/a/1190000000458953
http://sunwhut.com/2015/10/30/buildBlog/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值