Octopress将错误推送到GitHub

时间:2013-10-27 14:39:23

标签: ruby github jekyll

我正在尝试将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.

有什么问题?

5 个答案:

答案 0 :(得分:31)

由于这是主分支,即运行生成的页面的主分支,因此需要进入_deploy目录,然后执行git pull origin master。不知何故,您的部署目录已经不同步。您是否有多个本地仓库来编写和部署? (在不同的机器上说...)如果你这样做,那么你应该始终确保同步你的各种回购中的来源。

答案 1 :(得分:12)

DO

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

再试一次

rake generate
rake deploy

答案 2 :(得分:1)

尝试:

git checkout source

rake gen_deploy

答案 3 :(得分:0)

不要忘记为您的博客提交来源。

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

答案 4 :(得分:0)

我遇到了问题,并通过除去源分支的_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                  

```