V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
kobe1941
V2EX  ›  问与答

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

  •  
  •   kobe1941 · 2015-03-07 12:48:24 +08:00 · 3626 次点击
    这是一个创建于 3328 天前的主题,其中的信息可能已经有所发展或是发生改变。

    按照教程来,安装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

    第 1 条附言  ·  2015-03-07 13:42:11 +08:00
    使用jekyll doctor命令,错误提示:

    hf-27deMac-mini:octopress hf-27$ jekyll doctor
    Configuration file: /Users/hf-27/octopress/_config.yml
    jekyll 2.5.3 | Error: undefined method `each' for nil:NilClass
    第 2 条附言  ·  2015-03-07 16:49:50 +08:00
    第二个问题,我的git的config里边是这样子设置的:
    [core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
    precomposeunicode = true
    [remote "octopress"]
    url = git://github.com/imathis/octopress.git
    fetch = +refs/heads/*:refs/remotes/octopress/*
    [branch "source"]
    remote = origin
    merge = refs/heads/source
    [remote "origin"]
    url = https://github.com/kobe1941/kobe1941.github.io.git
    fetch = +refs/heads/*:refs/remotes/origin/*
    [branch "master"]
    remote = origin
    merge = refs/heads/master

    这个有什么问题么?为什么现在每次rake deploy 都会报错,说我分支没搞对
    16 条回复    2015-03-10 15:38:20 +08:00
    wbbim
        1
    wbbim  
       2015-03-07 12:51:04 +08:00 via iPhone
    只是搭博客的话
    Hexo Ghost Wordpress欢迎你
    kobe1941
        2
    kobe1941  
    OP
       2015-03-07 13:38:05 +08:00
    @wbbim 谢谢,不过由于已经选定octopress,还是继续一条路走到黑了
    chloerei
        3
    chloerei  
       2015-03-07 14:25:25 +08:00
    机智的我发现了问题:

    Generating...
    done.

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

    watch 只是让生成内容可以实时更新。
    kobe1941
        10
    kobe1941  
    OP
       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
        11
    guoruei  
       2015-03-07 19:40:18 +08:00
    虽然已经成功搭建 OCTOPRESS 了。参考 blog.guoruei.net
    但是发现帮不上楼主的忙,因为我现在也没弄明白。把帖子顶上去一下,让高手看看。(只能帮你到这了)

    :-)
    ChiangDi
        12
    ChiangDi  
       2015-03-07 21:21:47 +08:00
    jekyll 本来是很简单的,几条命令就搞定了, octopress 就是要把事情弄复杂化。
    kobe1941
        13
    kobe1941  
    OP
       2015-03-09 16:09:51 +08:00   ❤️ 1
    @guoruei 你好,我现在已经没什么问题了,虽然有警告,不过发布博文是正常的。
    guoruei
        14
    guoruei  
       2015-03-09 16:26:59 +08:00
    @kobe1941 干得好!鼓掌~现在我们算是 octopress 博友了。
    kobe1941
        15
    kobe1941  
    OP
       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
        16
    kobe1941  
    OP
       2015-03-10 15:38:20 +08:00
    加一句,本人博客是kobe1941.github.io
    暂时没卖域名,期待跟各位共同进步。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1279 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 23:24 · PVG 07:24 · LAX 16:24 · JFK 19:24
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.