mac 下利用 octopress 搭建博客时挂在了 rake generate 这一步,有两个疑问求解答

2015-03-07 12:48:24 +08:00
 kobe1941

按照教程来,安装brew,然后ruby什么的,环境都搭建好了。
我创建了几篇博客用rake preview在本地也可以预览,接下来按照这样的顺序
rake setup_github_pages
rake generate

到rake generate这一步的时候报错:
Generating Site with Jekyll
write source/stylesheets/screen.css
Configuration file: /Users/hf-27/octopress/_config.yml
Source: source
Destination: public
Generating...
done.
Auto-regeneration: disabled. Use --watch to enable.

使用rake --watch,也无济于事。
网上查的时候,怀疑是jekyll的问题,因为我用jekyll build命令时出现同样的问题,错误提示一模一样。

第二个疑问是,我没理会上面的问题,继续rake deploy,出现问题,此时我只是新建的几个博客,没有用git做其他操作(add commit都没有),错误提示有两段比较重要的,其中一段是这样的:
Deploying branch to Github Pages
Pulling any updates from Github Pages
cd _deploy
warning: no common commits
remote: Counting objects: 5067, done.
remote: Compressing objects: 100% (2233/2233), done.
remote: Total 5067 (delta 2447), reused 5060 (delta 2443), pack-reused 0
Receiving objects: 100% (5067/5067), 1.38 MiB | 663.00 KiB/s, done.
Resolving deltas: 100% (2447/2447), done.
From https://github.com/kobe1941/kobe1941.github.io
* [new branch] master -> origin/master
* [new branch] source -> origin/source
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/index.html

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

另外一段错误提示是:
Pushing generated _deploy website
To https://github.com/kobe1941/kobe1941.github.io.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/kobe1941/kobe1941.github.io.git'
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 -

我是指想搭个博客而已嘛,求各位帮忙解决这两个问题。

我操作的branch是source。

我安装的环境的版本:
hf-27deMac-mini:octopress hf-27$ gem --version
2.4.6
hf-27deMac-mini:octopress hf-27$ bundle --version
Bundler version 1.8.3
hf-27deMac-mini:octopress hf-27$ rake --version
rake, version 10.4.2
hf-27deMac-mini:octopress hf-27$ jekyll --version
jekyll 2.5.3

3637 次点击
所在节点    问与答
16 条回复
wbbim
2015-03-07 12:51:04 +08:00
只是搭博客的话
Hexo Ghost Wordpress欢迎你
kobe1941
2015-03-07 13:38:05 +08:00
@wbbim 谢谢,不过由于已经选定octopress,还是继续一条路走到黑了
chloerei
2015-03-07 14:25:25 +08:00
机智的我发现了问题:

Generating...
done.

哪里报错了?
kobe1941
2015-03-07 15:56:26 +08:00
@chloerei 下面有一句:Auto-regeneration: disabled. Use --watch to enable.
这个disabled不是错误么
kobe1941
2015-03-07 16:03:06 +08:00
@chloerei 请问第二个问题怎么解决呢?git的分支问题,我按照教程来的额,所有创建文章和提交都在source分支
chloerei
2015-03-07 16:22:07 +08:00
@kobe1941 翻译过来是:自动生成没打开,如果要打开就加 --watch 参数。这是个可选项。
chloerei
2015-03-07 16:25:19 +08:00
@kobe1941 我不清楚 octopress 怎么用,我觉得它非常复杂。
zealic
2015-03-07 16:53:59 +08:00
rake generate --watch
zealic
2015-03-07 16:54:56 +08:00
或者 jekyll --watch
这个只能算是警告,可以忽略

watch 只是让生成内容可以实时更新。
kobe1941
2015-03-07 18:28:49 +08:00
@zealic
@chloerei 1.我把github上的仓库删掉,重新弄了一遍,可能是之前添加ssh的时候没弄对,
2.关于第二个问题,我在这里找到了答案: http://stackoverflow.com/questions/19619280/octopress-pushing-error-to-github

现在可以使用正常了,Auto-regeneration: disabled. Use --watch to enable.这句话确实不是错误。

现在执行 rake deploy 依然会有
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

这个信息提示,我没理会,不影响使用。
guoruei
2015-03-07 19:40:18 +08:00
虽然已经成功搭建 OCTOPRESS 了。参考 blog.guoruei.net
但是发现帮不上楼主的忙,因为我现在也没弄明白。把帖子顶上去一下,让高手看看。(只能帮你到这了)

:-)
ChiangDi
2015-03-07 21:21:47 +08:00
jekyll 本来是很简单的,几条命令就搞定了, octopress 就是要把事情弄复杂化。
kobe1941
2015-03-09 16:09:51 +08:00
@guoruei 你好,我现在已经没什么问题了,虽然有警告,不过发布博文是正常的。
guoruei
2015-03-09 16:26:59 +08:00
@kobe1941 干得好!鼓掌~现在我们算是 octopress 博友了。
kobe1941
2015-03-10 15:10:03 +08:00
@guoruei 最后一个问题(刚刚解决掉了,使用```rake deploy```指令时会提示

```There is no tracking information for the current branch.
Please specify which branch you want to merge with.
```
是因为,这个指令会把博文部署到github上仓库的master分支,它的pull和push是系统自动的,系统报这个警告,说明需要我们设置.deploy/文件下默认pull和push的分支,根据提示,执行以下指令即可:

```
cd _deploy
git branch --set-upstream-to=origin/master master
```

注意这里的分支是master,因为是部署到github给别人看的,自己写博文的分支才是source
kobe1941
2015-03-10 15:38:20 +08:00
加一句,本人博客是kobe1941.github.io
暂时没卖域名,期待跟各位共同进步。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/175120

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX