【问题标题】:Octopress pushing error to GitHubOctopress 推送错误到 GitHub
【发布时间】:2013-11-06 07:25:36
【问题描述】:

我正在尝试将 octopress 推送到 github 页面,到目前为止一切正常,但是当我在显示 octopress 文件后执行 rake deploy 命令时,出现以下错误

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

有什么问题?

【问题讨论】:

  • @SLaks 出了什么问题以及如何解决它
  • 查看 Octopress Rakefile,它应该在推送之前拉取任何更改,但似乎这还没有发生。您是否尝试过按照错误消息的提示先运行git pull
  • 确实拉然后又做了'rake deploy'并且仍然得到同样的错误所以我再次拉然后显示一切都是最新的
  • 我只是删除了master 分支,然后又删除了rake deploy

标签: ruby github jekyll


【解决方案1】:

由于这是主分支,即运行您生成的页面的分支,您需要放入_deploy 目录,然后执行git pull origin master。不知何故,您的部署目录已不同步。您是否有不止一个本地仓库可以写入和部署? (比如说在不同的机器上......)如果你这样做了,那么你应该始终确保在各种 repos 上同步你的源代码。

【讨论】:

  • 这应该被标记为答案。不知道我是如何弄乱主分支的,但这解决了它,谢谢!
  • 我会删除 _deploy,将我的 repo(master 分支)克隆到 _deploy 目录,然后再次运行 rake 命令。我必须这样做,因为开始从不同的计算机编辑我的博客
【解决方案2】:

cd _deploy
git reset --hard origin/master
cd ..

再试一次

rake generate
rake deploy

【讨论】:

    【解决方案3】:

    试试:

    git checkout source

    rake gen_deploy

    【讨论】:

    • 仍然得到同样的错误信息并且octopress没有推送到github
    【解决方案4】:

    别忘了提交您博客的源代码。

    1. git add .
    2. git commit -m 'add source code to source branch'
    3. git push origin source

    【讨论】:

      【解决方案5】:

      我遇到了这个问题,并通过删除源分支的_deploy文件夹中的master分支来解决它。详细命令如下:

      // change directory to _deploy
      cd _deploy                             
      
      // check out local master branch
      git checkout master                    
      
      // rename local master to master2
      git branch -m master2                  
      
      // list of remote branch
      git branch -r                          
      
      // create a new local master branch and tracking remote master branch
      git checkout origin/master -b master   
      
      // pull the remote master branch, ensure that the local master branch has Already up-to-date.
      git pull                               
      
      // delete the local master2 branch if not needed.
      git branch -d master2                  
      

      ```

      【讨论】:

        猜你喜欢
        • 2023-03-16
        • 2017-11-27
        • 2023-01-10
        • 2012-10-29
        • 2016-12-30
        • 1970-01-01
        • 2021-06-11
        • 1970-01-01
        相关资源
        最近更新 更多