16

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

有什么问题?

4

5 回答 5

31

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

于 2013-10-28T06:16:22.920 回答
13

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

然后再试一次

rake generate
rake deploy
于 2015-09-30T22:50:42.627 回答
1

尝试:

git checkout source

rake gen_deploy

于 2013-10-27T16:05:15.960 回答
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                  

```

于 2018-07-23T02:51:13.757 回答
0

不要忘记提交您博客的源代码。

  1. git add .
  2. git commit -m 'add source code to source branch'
  3. git push origin source
于 2016-01-18T20:45:01.203 回答