jekyll new Blog cd Blog //cd是一个常用命令,到达相应的文件夹 jekyll serve //使用serve和server是一样的效果
在你的localhost:4000就会有一个默认的博客模板产生。
期间会遇到一些错误:
1.配置文件报错
D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/posix-spawn-0.3.9/lib/posix/spawn.rb:164 : warning: cannot close fd before spawn 'which' is not recognized as an internal or external command, operable program or batch file. Liquid Exception: undefined method `[]' for nil:NilClass in _posts/2014-08-01- welcome-to-jekyll.markdown jekyll 2.2.0 | Error: undefined method `[]' for nil:NilClass
解决办法:在项目的配置文件里面需要设置highlighter:rouge/pygments,传送门
2.下载RubyGems问题
ERROR: Could not find a valid gem 'jekyll' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server ce
rtificate B: certificate verify failed (https://rubygems.global.ssl.fastly.net/quick/Marshal.4.8/jekyll-1.3.0.gemspec.rz
)
解决办法:下载安全证书文件,在命令行运行下面的命令,如果提示curl不是外部或内部指定命令,则是你的电脑没有安装curl插件,需要下载该插件安装,很棒的一个教程,传送门
curl http://curl.haxx.se/ca/cacert.pem -o cacert.pem
3.安装Ruby不成功,提示错误,可以试试淘宝提供的国内镜像传送门
那么怎么通过github创建自己独有的个人网站呢?
1.下载git客户端,下载地址,下载后会有github图形界面客户端和git shell命令行工具两个,咱们使用git shell。
2.在git shell客户端输入
git init
来初始化项目;
git checkout --orphan gh-pages
创建一个gh-pages分支,该分支用来存放你的博客的所有文件,并且只能为该名称,因为github.com默认创建分支就是该名称;
git add . git commit -a -m'just a test'
开始准备发布项目,记住,不要漏掉后面的英文小数点;
git remote add origin https://github.com/username/projectName.git git push origin gh-pages
这样的话你的项目就创建成功。










