聪本脚的技术Blog

A blogging framework for hackers.

搭建octopress+github Page总结

开始用 octopress来写blog了,看博客看多了也想自己写写。今天就把搭建octopress +github page的过程总结下吧。

1,参考 这篇文章,但是细节还有提高。

细节1:Deploying to Github Pages octopress deploying描述有3种方式,第一种是 GitHub Pages 第二个是 发布到Heroku;第三个是Rsync,所以可以Deploying with Rsync。 我们选第一种 github page这样按照文档设定就可以了。

其中新手不知道执行命令在哪个文件夹下面,这里提醒下都在 octopress下面。当执行到 rake deploy时会做什么事情呢?上面文档也说得很清楚:只是没注意_deploy文件夹会建立git仓库来拉github上的page仓库导致push不成功命令log如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
moumoudeMacBook-Pro:octopress evan$ rake deploy
## Deploying branch to Github Pages 
## Pulling any updates from Github Pages 
cd _deploy
warning: no common commits
remote: Counting objects: 31, done.
remote: Total 31 (delta 0), reused 0 (delta 0), pack-reused 31
Unpacking objects: 100% (31/31), done.
From https://github.com/yeshengwu/yeshengwu.github.io
 * [new branch]      master     -> origin/master
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> master

cd -

rm -rf _deploy/assets
rm -rf _deploy/atom.xml
rm -rf _deploy/blog
rm -rf _deploy/favicon.png
rm -rf _deploy/images
rm -rf _deploy/index.html
rm -rf _deploy/javascripts
rm -rf _deploy/robots.txt
rm -rf _deploy/sitemap.xml
rm -rf _deploy/stylesheets

## Copying public to _deploy
cp -r public/. _deploy
cd _deploy

## Committing: Site updated at 2015-12-15 15:51:57 UTC
On branch master
nothing to commit, working directory clean

## Pushing generated _deploy website
Username for 'https://github.com': yeshengwu510168@gmail.com
Password for 'https://yeshengwu510168@gmail.com@github.com': 
To https://github.com/yeshengwu/yeshengwu.github.io
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/yeshengwu/yeshengwu.github.io'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

## Github Pages deploy complete
cd -

所以cd到_deploy后,设置好git upstream 后再rake deploy一次就可以了。

1
2
moumoudeMacBook-Pro:_deploy evan$ git branch --set-upstream-to=origin/master master
Branch master set up to track remote branch master from origin.

细节2:google api巨慢的问题 参考 技术小黑屋

总结

其实对于如何架设这样的blog,网上很多参考的文章,有的写的不错很有指导性,也有的直接转载却没有实际动手过。所以自己需要有个提醒,自己实战才知道会遇到哪些问题,把自己实战中遇到的细节写出来才能对别人有所帮助,千遍一律的东西网上一大把,关键是自己实战中的细节经验才是宝贵的。

2015总结 »