创建github个人站点
首先在github上面创建一个名为“xxx.github.io”的项目(其中xxx为对应github.com的用户名),下面是有了该项目后如何在本地创建相应的WEB项目,并且创建完成后上传即可:
1.安装Ruby,需要用到gem命令:
sudo apt-get install ruby
2.安装jekyll
gem install jekyll
执行此命令时会有如下错误提示:
guochongxin@slam:~$ gem install jekyll
ERROR:Could not find a valid gem 'jekyll' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - Errno::ECONNRESET: Connection reset by peer - SSL_connect (https://api.rubygems.org/latest_specs.4.8.gz)
访问不到rubygens.org,执行如下命令换个源:
gem sources --add https://ruby.taobao.org/ --remove https://rubygems.org/
接下来继续安装jekyll(多了sudo),会有如下错误提示:
guochongxin@slam:~$ sudo gem install jekyll
Fetching: ffi-1.9.10.gem (100%)
Building native extensions.This could take a while...
ERROR:Error installing jekyll:
ERROR: Failed to build gem native extension.
/usr/bin/ruby2.1 extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.1.0/gems/ffi-1.9.10 for inspection.
Results logged to /var/lib/gems/2.1.0/extensions/x86_64-linux/2.1.0/ffi-1.9.10/gem_make.out
此时执行如下命令可解决该问题:
sudo apt-get install ruby-dev
执行后再执行如下命令进行安装:
sudo gem install jekyll
3.创建jekyll site
安装好工具后,接下来Clone项目并创建相应的jekyll website:
cd ~
git clone https://github.com/guochongxin/guochongxin.github.io.git
cd guochongxin.github.io/
执行完上述三命令后,将创建的github项目克隆并进入到项目目录,接下来执行如下命令创建website:
jekyll new . --force
4.预览创建的site
执行jekyll serve命令,使用网页浏览器访问http://127.0.0.1:4000即可本地测试了。
5.提交github
上面验证好后,执行如下命令提交到github上面:
git add --all
git commit -m "Create Jekyll Static Website"
git push origin master
6.访问github个人网站
代码提交后,等待一会,打开网页浏览器访问guochongxin.github.io,就可以刷出页面了。
7.后记
在创建的jekyll项目的_posts目录下,创建相应的MarkDown文件,一个文件对应一个文章,此内容请查阅参考网络说明,可参考如下网址:
http://www.jianshu.com/p/6ede0dee08bf
http://blog.fens.me/hexo-blog-github/
http://www.jianshu.com/p/05289a4bc8b2
https://help.github.com/articles/using-a-custom-domain-with-github-pages/
http://www.dozer.cc/2014/08/wordpress-to-github-page-jekyll.html
https://jekyllrb.com/docs/quickstart/